Package i2p.susi.util
Class MemoryBuffer
- java.lang.Object
-
- i2p.susi.util.MemoryBuffer
-
-
Constructor Summary
Constructors Constructor Description MemoryBuffer()
MemoryBuffer(int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getContent()
InputStream
getInputStream()
int
getLength()
Current size.int
getOffset()
OutputStream
getOutputStream()
void
readComplete(boolean success)
Top-level reader MUST call this to close the input stream.String
toString()
void
writeComplete(boolean success)
Deletes the data if success is false
-
-
-
Method Detail
-
getInputStream
public InputStream getInputStream() throws IOException
- Specified by:
getInputStream
in interfaceBuffer
- Returns:
- new ByteArrayInputStream
- Throws:
IOException
-
getOutputStream
public OutputStream getOutputStream()
- Specified by:
getOutputStream
in interfaceBuffer
- Returns:
- new or existing ByteArrayOutputStream
-
readComplete
public void readComplete(boolean success)
Description copied from interface:Buffer
Top-level reader MUST call this to close the input stream.- Specified by:
readComplete
in interfaceBuffer
-
writeComplete
public void writeComplete(boolean success)
Deletes the data if success is false- Specified by:
writeComplete
in interfaceBuffer
- Parameters:
success
- if false, deletes any resources
-
getContent
public byte[] getContent()
- Returns:
- content if writeComplete(true) was called, otherwise null
-
-