| Constructor and Description |
|---|
MemoryBuffer()Create a MemoryBuffer with default initial capacity. |
MemoryBuffer(int size)Create a MemoryBuffer with specified initial capacity. |
| Modifier and Type | Method and Description |
|---|---|
byte[] | getContent()Get the buffered content after writeComplete(true). |
InputStream | getInputStream()Get an InputStream for the buffered data. |
int | getLength()Get the current size of data in this buffer. |
int | getOffset()Get the offset into the underlying data. |
OutputStream | getOutputStream()Get an OutputStream for writing data to this buffer. |
void | readComplete(boolean success)Top-level reader MUST call this to close the input stream. |
String | toString() |
void | writeComplete(boolean success)Finalize the write. |
public MemoryBuffer()
public MemoryBuffer(int size)
size - the initial capacity in bytespublic byte[] getContent()
public InputStream getInputStream() throws IOException
getInputStream in interface BufferIOException - if no data has been writtenpublic int getLength()
public int getOffset()
Bufferpublic OutputStream getOutputStream()
getOutputStream in interface Bufferpublic void readComplete(boolean success)
BufferreadComplete in interface Buffersuccess - if false, the read is considered failedpublic void writeComplete(boolean success)
writeComplete in interface Buffersuccess - if true, stores the data; if false, discards it