Package 

Class MessageBufferPacker

  • All Implemented Interfaces:
    java.io.Closeable , java.io.Flushable , java.lang.AutoCloseable

    
    public class MessageBufferPacker
    extends MessagePacker
                        

    MessagePacker that is useful to produce byte array output.

    This class allocates a new buffer instead of resizing the buffer when data doesn't fit in the initial capacity. This is faster than ByteArrayOutputStream especially when size of written bytes is large because resizing a buffer usually needs to copy contents of the buffer.

    • Method Summary

      Modifier and Type Method Description
      MessageBufferOutput reset(MessageBufferOutput out) Replaces underlying output.
      void clear() Clears the written data.
      Array<byte> toByteArray() Gets copy of the written data as a byte array.
      MessageBuffer toMessageBuffer() Gets the written data as a MessageBuffer.
      List<MessageBuffer> toBufferList() Returns the written data as a list of MessageBuffer.
      int getBufferSize()
      • Methods inherited from class com.batch.android.msgpack.core.MessagePacker

        addPayload, addPayload, close, flush, getTotalWrittenBytes, packArrayHeader, packBigInteger, packBinaryHeader, packBoolean, packByte, packDouble, packExtensionTypeHeader, packFloat, packInt, packLong, packMapHeader, packNil, packRawStringHeader, packShort, packString, packValue, writePayload, writePayload
      • Methods inherited from class java.io.Closeable

        close
      • Methods inherited from class java.io.Flushable

        flush
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait