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()InputStreamgetInputStream()intgetLength()Current size.intgetOffset()OutputStreamgetOutputStream()voidreadComplete(boolean success)Top-level reader MUST call this to close the input stream.StringtoString()voidwriteComplete(boolean success)Deletes the data if success is false
-
-
-
Method Detail
-
getInputStream
public InputStream getInputStream() throws IOException
- Specified by:
getInputStreamin interfaceBuffer- Returns:
- new ByteArrayInputStream
- Throws:
IOException
-
getOutputStream
public OutputStream getOutputStream()
- Specified by:
getOutputStreamin interfaceBuffer- Returns:
- new or existing ByteArrayOutputStream
-
readComplete
public void readComplete(boolean success)
Description copied from interface:BufferTop-level reader MUST call this to close the input stream.- Specified by:
readCompletein interfaceBuffer
-
writeComplete
public void writeComplete(boolean success)
Deletes the data if success is false- Specified by:
writeCompletein interfaceBuffer- Parameters:
success- if false, deletes any resources
-
getContent
public byte[] getContent()
- Returns:
- content if writeComplete(true) was called, otherwise null
-
-