Class ArrayBufferInput
- java.lang.Object
-
- com.batch.android.msgpack.core.buffer.ArrayBufferInput
-
- All Implemented Interfaces:
MessageBufferInput,java.io.Closeable,java.lang.AutoCloseable
public class ArrayBufferInput extends java.lang.Object implements MessageBufferInput
MessageBufferInput adapter for byte arrays
-
-
Constructor Summary
Constructors Constructor Description ArrayBufferInput(byte[] arr)ArrayBufferInput(byte[] arr, int offset, int length)ArrayBufferInput(MessageBuffer buf)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the input.MessageBuffernext()Returns a next buffer to read.voidreset(byte[] arr)voidreset(byte[] arr, int offset, int len)MessageBufferreset(MessageBuffer buf)Reset buffer.
-
-
-
Constructor Detail
-
ArrayBufferInput
public ArrayBufferInput(MessageBuffer buf)
-
ArrayBufferInput
public ArrayBufferInput(byte[] arr)
-
ArrayBufferInput
public ArrayBufferInput(byte[] arr, int offset, int length)
-
-
Method Detail
-
reset
public MessageBuffer reset(MessageBuffer buf)
Reset buffer. This method returns the old buffer.- Parameters:
buf- new buffer. This can be null to make this input empty.- Returns:
- the old buffer.
-
reset
public void reset(byte[] arr)
-
reset
public void reset(byte[] arr, int offset, int len)
-
next
public MessageBuffer next()
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.
-
close
public void close()
Description 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
-
-