Class MessagePack.PackerConfig

  • All Implemented Interfaces:
    java.lang.Cloneable
    Enclosing class:
    MessagePack

    public static class MessagePack.PackerConfig
    extends java.lang.Object
    implements java.lang.Cloneable
    MessagePacker configuration.
    • Constructor Detail

      • PackerConfig

        public PackerConfig()
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • newPacker

        public MessagePacker newPacker​(MessageBufferOutput out)
        Creates a packer that serializes objects into the specified output.

        MessageBufferOutput is an interface that lets applications customize memory allocation of internal buffer of MessagePacker.

        Parameters:
        out - A MessageBufferOutput that allocates buffer chunks and receives the buffer chunks with packed data filled in them
        Returns:
        A new MessagePacker instance
      • newPacker

        public MessagePacker newPacker​(java.io.OutputStream out)
        Creates a packer that serializes objects into the specified output stream.

        Note that you don't have to wrap OutputStream in BufferedOutputStream because MessagePacker has buffering internally.

        Parameters:
        out - The output stream that receives sequence of bytes
        Returns:
        A new MessagePacker instance
      • newPacker

        public MessagePacker newPacker​(java.nio.channels.WritableByteChannel channel)
        Creates a packer that serializes objects into the specified writable channel.
        Parameters:
        channel - The output channel that receives sequence of bytes
        Returns:
        A new MessagePacker instance
      • newBufferPacker

        public MessageBufferPacker newBufferPacker()
        Creates a packer that serializes objects into byte arrays.

        This method provides an optimized implementation of newDefaultBufferPacker(new ByteArrayOutputStream()).

        Returns:
        A new MessageBufferPacker instance
      • withSmallStringOptimizationThreshold

        public MessagePack.PackerConfig withSmallStringOptimizationThreshold​(int length)
        Use String.getBytes() for converting Java Strings that are shorter than this threshold. Note that this parameter is subject to change.
      • getSmallStringOptimizationThreshold

        public int getSmallStringOptimizationThreshold()
      • withBufferFlushThreshold

        public MessagePack.PackerConfig withBufferFlushThreshold​(int bytes)
        When the next payload size exceeds this threshold, MessagePacker will call Flushable.flush() before writing more data (default: 8192).
      • getBufferFlushThreshold

        public int getBufferFlushThreshold()
      • getBufferSize

        public int getBufferSize()
      • withStr8FormatSupport

        public MessagePack.PackerConfig withStr8FormatSupport​(boolean str8FormatSupport)
        Disable str8 format when needed backward compatibility between different msgpack serializer versions. default true (str8 supported enabled)
      • isStr8FormatSupport

        public boolean isStr8FormatSupport()