public static class MessagePack.PackerConfig
extends java.lang.Object
implements java.lang.Cloneable
Constructor and Description |
---|
PackerConfig() |
Modifier and Type | Method and 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(MessageBufferOutput out)
Creates a packer that serializes objects into the specified output.
|
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.
|
MessagePack.PackerConfig |
withBufferFlushThreshold(int bytes)
When the next payload size exceeds this threshold, MessagePacker will call
Flushable.flush() before writing more data (default: 8192). |
MessagePack.PackerConfig |
withBufferSize(int bytes)
When a packer is created with
newPacker(OutputStream) or newPacker(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.
|
public MessagePack.PackerConfig clone()
clone
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public MessagePacker newPacker(MessageBufferOutput out)
MessageBufferOutput
is an interface that lets applications customize memory
allocation of internal buffer of MessagePacker
.
out
- A MessageBufferOutput that allocates buffer chunks and receives the buffer chunks with packed data filled in thempublic MessagePacker newPacker(java.io.OutputStream out)
Note that you don't have to wrap OutputStream in BufferedOutputStream because MessagePacker has buffering internally.
out
- The output stream that receives sequence of bytespublic MessagePacker newPacker(java.nio.channels.WritableByteChannel channel)
channel
- The output channel that receives sequence of bytespublic MessageBufferPacker newBufferPacker()
This method provides an optimized implementation of newDefaultBufferPacker(new ByteArrayOutputStream())
.
public MessagePack.PackerConfig withSmallStringOptimizationThreshold(int length)
public int getSmallStringOptimizationThreshold()
public MessagePack.PackerConfig withBufferFlushThreshold(int bytes)
Flushable.flush()
before writing more data (default: 8192).public int getBufferFlushThreshold()
public MessagePack.PackerConfig withBufferSize(int bytes)
newPacker(OutputStream)
or newPacker(WritableByteChannel)
, the stream will be
buffered with this size of buffer (default: 8192).public int getBufferSize()
public MessagePack.PackerConfig withStr8FormatSupport(boolean str8FormatSupport)
public boolean isStr8FormatSupport()