public static class MessagePack.UnpackerConfig
extends java.lang.Object
implements java.lang.Cloneable
Constructor and Description |
---|
UnpackerConfig() |
Modifier and Type | Method and Description |
---|---|
MessagePack.UnpackerConfig |
clone() |
boolean |
equals(java.lang.Object obj) |
java.nio.charset.CodingErrorAction |
getActionOnMalformedString() |
java.nio.charset.CodingErrorAction |
getActionOnUnmappableString() |
boolean |
getAllowReadingBinaryAsString() |
boolean |
getAllowReadingStringAsBinary() |
int |
getBufferSize() |
int |
getStringDecoderBufferSize() |
int |
getStringSizeLimit() |
int |
hashCode() |
MessageUnpacker |
newUnpacker(byte[] contents)
Creates an unpacker that deserializes objects from a specified byte array.
|
MessageUnpacker |
newUnpacker(byte[] contents,
int offset,
int length)
Creates an unpacker that deserializes objects from subarray of a specified byte array.
|
MessageUnpacker |
newUnpacker(java.nio.ByteBuffer contents)
Creates an unpacker that deserializes objects from a specified ByteBuffer.
|
MessageUnpacker |
newUnpacker(java.io.InputStream in)
Creates an unpacker that deserializes objects from a specified input stream.
|
MessageUnpacker |
newUnpacker(MessageBufferInput in)
Creates an unpacker that deserializes objects from a specified input.
|
MessageUnpacker |
newUnpacker(java.nio.channels.ReadableByteChannel channel)
Creates an unpacker that deserializes objects from a specified readable channel.
|
MessagePack.UnpackerConfig |
withActionOnMalformedString(java.nio.charset.CodingErrorAction action)
Sets action when encountered a malformed input (default: REPLACE)
|
MessagePack.UnpackerConfig |
withActionOnUnmappableString(java.nio.charset.CodingErrorAction action)
Sets action when an unmappable character is found (default: REPLACE)
|
MessagePack.UnpackerConfig |
withAllowReadingBinaryAsString(boolean enable)
Allows unpackString and unpackRawStringHeader and unpackString to read bin format family (default: true)
|
MessagePack.UnpackerConfig |
withAllowReadingStringAsBinary(boolean enable)
Allows unpackBinaryHeader to read str format family (default: true)
|
MessagePack.UnpackerConfig |
withBufferSize(int bytes)
When a packer is created with newUnpacker(OutputStream) or newUnpacker(WritableByteChannel), the stream will be
buffered with this size of buffer (default: 8192).
|
MessagePack.UnpackerConfig |
withStringDecoderBufferSize(int bytes) |
MessagePack.UnpackerConfig |
withStringSizeLimit(int bytes)
unpackString size limit (default: Integer.MAX_VALUE).
|
public MessagePack.UnpackerConfig 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 MessageUnpacker newUnpacker(MessageBufferInput in)
MessageBufferInput
is an interface that lets applications customize memory
allocation of internal buffer of MessageUnpacker
.
in
- The input stream that provides sequence of buffer chunks and optionally reuses them when MessageUnpacker consumed one completelypublic MessageUnpacker newUnpacker(java.io.InputStream in)
Note that you don't have to wrap InputStream in BufferedInputStream because MessageUnpacker has buffering internally.
in
- The input stream that provides sequence of bytespublic MessageUnpacker newUnpacker(java.nio.channels.ReadableByteChannel channel)
channel
- The input channel that provides sequence of bytespublic MessageUnpacker newUnpacker(byte[] contents)
This method provides an optimized implementation of newDefaultUnpacker(new ByteArrayInputStream(contents))
.
contents
- The byte array that contains packed objects in MessagePack formatpublic MessageUnpacker newUnpacker(byte[] contents, int offset, int length)
This method provides an optimized implementation of newDefaultUnpacker(new ByteArrayInputStream(contents, offset, length))
.
contents
- The byte array that contains packed objectsoffset
- The index of the first bytelength
- The number of bytespublic MessageUnpacker newUnpacker(java.nio.ByteBuffer contents)
Note that the returned unpacker reads data from the current position of the ByteBuffer until its limit.
However, its position does not change when unpacker reads data. You may use
MessageUnpacker.getTotalReadBytes()
to get actual amount of bytes used in ByteBuffer.
contents
- The byte buffer that contains packed objectspublic MessagePack.UnpackerConfig withAllowReadingStringAsBinary(boolean enable)
public boolean getAllowReadingStringAsBinary()
public MessagePack.UnpackerConfig withAllowReadingBinaryAsString(boolean enable)
public boolean getAllowReadingBinaryAsString()
public MessagePack.UnpackerConfig withActionOnMalformedString(java.nio.charset.CodingErrorAction action)
public java.nio.charset.CodingErrorAction getActionOnMalformedString()
public MessagePack.UnpackerConfig withActionOnUnmappableString(java.nio.charset.CodingErrorAction action)
public java.nio.charset.CodingErrorAction getActionOnUnmappableString()
public MessagePack.UnpackerConfig withStringSizeLimit(int bytes)
public int getStringSizeLimit()
public MessagePack.UnpackerConfig withStringDecoderBufferSize(int bytes)
public int getStringDecoderBufferSize()
public MessagePack.UnpackerConfig withBufferSize(int bytes)
public int getBufferSize()