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.Cloneable
MessagePacker configuration.
-
-
Constructor Summary
Constructors Constructor Description PackerConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessagePack.PackerConfig
clone()
boolean
equals(java.lang.Object obj)
int
getBufferFlushThreshold()
int
getBufferSize()
int
getSmallStringOptimizationThreshold()
int
hashCode()
boolean
isStr8FormatSupport()
MessageBufferPacker
newBufferPacker()
Creates a packer that serializes objects into byte arrays.MessagePacker
newPacker(java.io.OutputStream out)
Creates a packer that serializes objects into the specified output stream.MessagePacker
newPacker(java.nio.channels.WritableByteChannel channel)
Creates a packer that serializes objects into the specified writable channel.MessagePacker
newPacker(MessageBufferOutput out)
Creates a packer that serializes objects into the specified output.MessagePack.PackerConfig
withBufferFlushThreshold(int bytes)
When the next payload size exceeds this threshold, MessagePacker will callFlushable.flush()
before writing more data (default: 8192).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).MessagePack.PackerConfig
withSmallStringOptimizationThreshold(int length)
Use String.getBytes() for converting Java Strings that are shorter than this threshold.MessagePack.PackerConfig
withStr8FormatSupport(boolean str8FormatSupport)
Disable str8 format when needed backward compatibility between different msgpack serializer versions.
-
-
-
Method Detail
-
clone
public MessagePack.PackerConfig clone()
- Overrides:
clone
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.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 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()
-
-