Class ChannelBufferInput
- java.lang.Object
-
- com.batch.android.msgpack.core.buffer.ChannelBufferInput
-
- All Implemented Interfaces:
MessageBufferInput,java.io.Closeable,java.lang.AutoCloseable
public class ChannelBufferInput extends java.lang.Object implements MessageBufferInput
MessageBufferInputadapter forReadableByteChannel
-
-
Constructor Summary
Constructors Constructor Description ChannelBufferInput(java.nio.channels.ReadableByteChannel channel)ChannelBufferInput(java.nio.channels.ReadableByteChannel channel, int bufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the input.MessageBuffernext()Returns a next buffer to read.java.nio.channels.ReadableByteChannelreset(java.nio.channels.ReadableByteChannel channel)Reset channel.
-
-
-
Method Detail
-
reset
public java.nio.channels.ReadableByteChannel reset(java.nio.channels.ReadableByteChannel channel) throws java.io.IOExceptionReset channel. This method doesn't close the old resource.- Parameters:
channel- new channel- 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
-
-