Class InputStreamBufferInput
- java.lang.Object
-
- com.batch.android.msgpack.core.buffer.InputStreamBufferInput
-
- All Implemented Interfaces:
MessageBufferInput,java.io.Closeable,java.lang.AutoCloseable
public class InputStreamBufferInput extends java.lang.Object implements MessageBufferInput
MessageBufferInputadapter forInputStream
-
-
Constructor Summary
Constructors Constructor Description InputStreamBufferInput(java.io.InputStream in)InputStreamBufferInput(java.io.InputStream in, int bufferSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the input.static MessageBufferInputnewBufferInput(java.io.InputStream in)MessageBuffernext()Returns a next buffer to read.java.io.InputStreamreset(java.io.InputStream in)Reset Stream.
-
-
-
Method Detail
-
newBufferInput
public static MessageBufferInput newBufferInput(java.io.InputStream in)
-
reset
public java.io.InputStream reset(java.io.InputStream in) throws java.io.IOExceptionReset Stream. This method doesn't close the old resource.- Parameters:
in- new stream- Returns:
- the old resource
- Throws:
java.io.IOException
-
next
public MessageBuffer next() throws java.io.IOException
Description copied from interface:MessageBufferInputReturns a next buffer to read.This method should return a MessageBuffer instance that has data filled in. When this method is called twice, the previously returned buffer is no longer used. Thus implementation of this method can safely discard it. This is useful when it uses a memory pool.
- Specified by:
nextin interfaceMessageBufferInput- Returns:
- the next MessageBuffer, or return null if no more buffer is available.
- Throws:
java.io.IOException- when IO error occurred when reading the data
-
close
public void close() throws java.io.IOExceptionDescription copied from interface:MessageBufferInputCloses the input.When this method is called, the buffer previously returned from
MessageBufferInput.next()method is no longer used. Thus implementation of this method can safely discard it.If the input is already closed then invoking this method has no effect.
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceMessageBufferInput- Throws:
java.io.IOException- when IO error occurred when closing the data source
-
-