Package org.msgpack.core
Class MessagePack.PackerConfig
- java.lang.Object
-
- org.msgpack.core.MessagePack.PackerConfig
-
- All Implemented Interfaces:
java.lang.Cloneable
- Enclosing class:
- MessagePack
public static class MessagePack.PackerConfig extends java.lang.Object implements java.lang.CloneableMessagePacker configuration.
-
-
Constructor Summary
Constructors Constructor Description PackerConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessagePack.PackerConfigclone()booleanequals(java.lang.Object obj)intgetBufferFlushThreshold()intgetBufferSize()intgetSmallStringOptimizationThreshold()inthashCode()booleanisStr8FormatSupport()MessageBufferPackernewBufferPacker()Creates a packer that serializes objects into byte arrays.MessagePackernewPacker(java.io.OutputStream out)Creates a packer that serializes objects into the specified output stream.MessagePackernewPacker(java.nio.channels.WritableByteChannel channel)Creates a packer that serializes objects into the specified writable channel.MessagePackernewPacker(MessageBufferOutput out)Creates a packer that serializes objects into the specified output.MessagePack.PackerConfigwithBufferFlushThreshold(int bytes)When the next payload size exceeds this threshold, MessagePacker will callFlushable.flush()before writing more data (default: 8192).MessagePack.PackerConfigwithBufferSize(int bytes)When a packer is created withnewPacker(OutputStream)ornewPacker(WritableByteChannel), the stream will be buffered with this size of buffer (default: 8192).MessagePack.PackerConfigwithSmallStringOptimizationThreshold(int length)Use String.getBytes() for converting Java Strings that are shorter than this threshold.MessagePack.PackerConfigwithStr8FormatSupport(boolean str8FormatSupport)Disable str8 format when needed backward compatibility between different msgpack serializer versions.
-
-
-
Method Detail
-
clone
public MessagePack.PackerConfig clone()
- Overrides:
clonein classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
newPacker
public MessagePacker newPacker(MessageBufferOutput out)
Creates a packer that serializes objects into the specified output.MessageBufferOutputis an interface that lets applications customize memory allocation of internal buffer ofMessagePacker.- 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 callFlushable.flush()before writing more data (default: 8192).
-
getBufferFlushThreshold
public int getBufferFlushThreshold()
-
withBufferSize
public MessagePack.PackerConfig withBufferSize(int bytes)
When a packer is created withnewPacker(OutputStream)ornewPacker(WritableByteChannel), the stream will be buffered with this size of buffer (default: 8192).
-
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()
-
-