-
- All Implemented Interfaces:
-
java.lang.Cloneable
public class MessagePack.PackerConfig implements Cloneable
MessagePacker configuration.
-
-
Field Summary
Fields Modifier and Type Field Description private intsmallStringOptimizationThresholdprivate intbufferFlushThresholdprivate intbufferSize
-
Constructor Summary
Constructors Constructor Description MessagePack.PackerConfig()
-
Method Summary
Modifier and Type Method Description intgetSmallStringOptimizationThreshold()intgetBufferFlushThreshold()intgetBufferSize()MessagePack.PackerConfigclone()inthashCode()booleanequals(Object obj)MessagePackernewPacker(MessageBufferOutput out)Creates a packer that serializes objects into the specified output. MessagePackernewPacker(OutputStream out)Creates a packer that serializes objects into the specified output stream. MessagePackernewPacker(WritableByteChannel channel)Creates a packer that serializes objects into the specified writable channel. MessageBufferPackernewBufferPacker()Creates a packer that serializes objects into byte arrays. MessagePack.PackerConfigwithSmallStringOptimizationThreshold(int length)Use String.getBytes() for converting Java Strings that are shorter than this threshold.Note that this parameter is subject to change. MessagePack.PackerConfigwithBufferFlushThreshold(int bytes)When the next payload size exceeds this threshold, MessagePacker will call flush before writing more data (default: 8192). MessagePack.PackerConfigwithBufferSize(int bytes)When a packer is created with newPacker or newPacker, the stream will bebuffered with this size of buffer (default: 8192). MessagePack.PackerConfigwithStr8FormatSupport(boolean str8FormatSupport)Disable str8 format when needed backward compatibility betweendifferent msgpack serializer versions. booleanisStr8FormatSupport()-
-
Method Detail
-
getSmallStringOptimizationThreshold
int getSmallStringOptimizationThreshold()
-
getBufferFlushThreshold
int getBufferFlushThreshold()
-
getBufferSize
int getBufferSize()
-
clone
MessagePack.PackerConfig clone()
-
hashCode
int hashCode()
-
newPacker
MessagePacker newPacker(MessageBufferOutput out)
Creates a packer that serializes objects into the specified output.
com.batch.android.msgpack.core.buffer.MessageBufferOutput is an interface that lets applications customize memoryallocation of internal buffer of MessagePacker.
- Parameters:
out- A MessageBufferOutput that allocates buffer chunks and receives the buffer chunks with packed data filled in them
-
newPacker
MessagePacker newPacker(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 bufferinginternally.
- Parameters:
out- The output stream that receives sequence of bytes
-
newPacker
MessagePacker newPacker(WritableByteChannel channel)
Creates a packer that serializes objects into the specified writable channel.
- Parameters:
channel- The output channel that receives sequence of bytes
-
newBufferPacker
MessageBufferPacker newBufferPacker()
Creates a packer that serializes objects into byte arrays.
This method provides an optimized implementation of
newDefaultBufferPacker(new ByteArrayOutputStream()).
-
withSmallStringOptimizationThreshold
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.
-
withBufferFlushThreshold
MessagePack.PackerConfig withBufferFlushThreshold(int bytes)
When the next payload size exceeds this threshold, MessagePacker will call flush before writing more data (default: 8192).
-
withBufferSize
MessagePack.PackerConfig withBufferSize(int bytes)
-
withStr8FormatSupport
MessagePack.PackerConfig withStr8FormatSupport(boolean str8FormatSupport)
Disable str8 format when needed backward compatibility betweendifferent msgpack serializer versions.default true (str8 supported enabled)
-
isStr8FormatSupport
boolean isStr8FormatSupport()
-
-
-
-