- All Known Implementing Classes:
FileBuffer, GzipFileBuffer, MemoryBuffer, OutputStreamBuffer, ReadBuffer
public interface Buffer
Base interface for data buffers. Data access is primarily through streams, with additional methods available in subclasses.
Method Summary
All MethodsModifier and TypeMethodDescriptionGet an InputStream for reading from this buffer.intGet the length of data in this buffer.intGet the offset into the underlying data.Get an OutputStream for writing to this buffer.voidreadComplete(boolean success) Top-level reader MUST call this to close the input stream.voidwriteComplete(boolean success) Writer MUST call this when done.
Method Details
getInputStream
Get an InputStream for reading from this buffer.- Returns:
- InputStream for reading
- Throws:
IOException- on I/O error
getOutputStream
Get an OutputStream for writing to this buffer.- Returns:
- OutputStream for writing
- Throws:
IOException- on I/O error
readComplete
void readComplete(boolean success) Top-level reader MUST call this to close the input stream.- Parameters:
success- if false, the read is considered failed
writeComplete
void writeComplete(boolean success) Writer MUST call this when done.- Parameters:
success- if false, deletes any resources
getLength
int getLength()Get the length of data in this buffer.- Returns:
- length in bytes
getOffset
int getOffset()Get the offset into the underlying data.- Returns:
- offset in bytes