-
- All Implemented Interfaces:
-
java.lang.Cloneable
public class MessagePack.UnpackerConfig implements Cloneable
MessageUnpacker configuration.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanallowReadingStringAsBinaryprivate booleanallowReadingBinaryAsStringprivate CodingErrorActionactionOnMalformedStringprivate CodingErrorActionactionOnUnmappableStringprivate intstringSizeLimitprivate intbufferSizeprivate intstringDecoderBufferSize
-
Constructor Summary
Constructors Constructor Description MessagePack.UnpackerConfig()
-
Method Summary
Modifier and Type Method Description booleangetAllowReadingStringAsBinary()booleangetAllowReadingBinaryAsString()CodingErrorActiongetActionOnMalformedString()CodingErrorActiongetActionOnUnmappableString()intgetStringSizeLimit()intgetBufferSize()intgetStringDecoderBufferSize()MessagePack.UnpackerConfigclone()inthashCode()booleanequals(Object obj)MessageUnpackernewUnpacker(MessageBufferInput in)Creates an unpacker that deserializes objects from a specified input. MessageUnpackernewUnpacker(InputStream in)Creates an unpacker that deserializes objects from a specified input stream. MessageUnpackernewUnpacker(ReadableByteChannel channel)Creates an unpacker that deserializes objects from a specified readable channel. MessageUnpackernewUnpacker(Array<byte> contents)Creates an unpacker that deserializes objects from a specified byte array. MessageUnpackernewUnpacker(Array<byte> contents, int offset, int length)Creates an unpacker that deserializes objects from subarray of a specified byte array. MessageUnpackernewUnpacker(ByteBuffer contents)Creates an unpacker that deserializes objects from a specified ByteBuffer. MessagePack.UnpackerConfigwithAllowReadingStringAsBinary(boolean enable)Allows unpackBinaryHeader to read str format family (default: true) MessagePack.UnpackerConfigwithAllowReadingBinaryAsString(boolean enable)Allows unpackString and unpackRawStringHeader and unpackString to read bin format family (default: true) MessagePack.UnpackerConfigwithActionOnMalformedString(CodingErrorAction action)Sets action when encountered a malformed input (default: REPLACE) MessagePack.UnpackerConfigwithActionOnUnmappableString(CodingErrorAction action)Sets action when an unmappable character is found (default: REPLACE) MessagePack.UnpackerConfigwithStringSizeLimit(int bytes)unpackString size limit (default: Integer.MAX_VALUE). MessagePack.UnpackerConfigwithStringDecoderBufferSize(int bytes)MessagePack.UnpackerConfigwithBufferSize(int bytes)When a packer is created with newUnpacker(OutputStream) or newUnpacker(WritableByteChannel), the stream will bebuffered with this size of buffer (default: 8192). -
-
Method Detail
-
getAllowReadingStringAsBinary
boolean getAllowReadingStringAsBinary()
-
getAllowReadingBinaryAsString
boolean getAllowReadingBinaryAsString()
-
getActionOnMalformedString
CodingErrorAction getActionOnMalformedString()
-
getActionOnUnmappableString
CodingErrorAction getActionOnUnmappableString()
-
getStringSizeLimit
int getStringSizeLimit()
-
getBufferSize
int getBufferSize()
-
getStringDecoderBufferSize
int getStringDecoderBufferSize()
-
clone
MessagePack.UnpackerConfig clone()
-
hashCode
int hashCode()
-
newUnpacker
MessageUnpacker newUnpacker(MessageBufferInput in)
Creates an unpacker that deserializes objects from a specified input.
com.batch.android.msgpack.core.buffer.MessageBufferInput is an interface that lets applications customize memoryallocation of internal buffer of MessageUnpacker.
- Parameters:
in- The input stream that provides sequence of buffer chunks and optionally reuses them when MessageUnpacker consumed one completely
-
newUnpacker
MessageUnpacker newUnpacker(InputStream in)
Creates an unpacker that deserializes objects from a specified input stream.
Note that you don't have to wrap InputStream in BufferedInputStream because MessageUnpacker has bufferinginternally.
- Parameters:
in- The input stream that provides sequence of bytes
-
newUnpacker
MessageUnpacker newUnpacker(ReadableByteChannel channel)
Creates an unpacker that deserializes objects from a specified readable channel.
- Parameters:
channel- The input channel that provides sequence of bytes
-
newUnpacker
MessageUnpacker newUnpacker(Array<byte> contents)
Creates an unpacker that deserializes objects from a specified byte array.
This method provides an optimized implementation of
newDefaultUnpacker(new ByteArrayInputStream(contents)).- Parameters:
contents- The byte array that contains packed objects in MessagePack format
-
newUnpacker
MessageUnpacker newUnpacker(Array<byte> contents, int offset, int length)
Creates an unpacker that deserializes objects from subarray of a specified byte array.
This method provides an optimized implementation of
newDefaultUnpacker(new ByteArrayInputStream(contents, offset, length)).- Parameters:
contents- The byte array that contains packed objectsoffset- The index of the first bytelength- The number of bytes
-
newUnpacker
MessageUnpacker newUnpacker(ByteBuffer contents)
Creates an unpacker that deserializes objects from a specified ByteBuffer.
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 getTotalReadBytes to get actual amount of bytes used in ByteBuffer.
- Parameters:
contents- The byte buffer that contains packed objects
-
withAllowReadingStringAsBinary
MessagePack.UnpackerConfig withAllowReadingStringAsBinary(boolean enable)
Allows unpackBinaryHeader to read str format family (default: true)
-
withAllowReadingBinaryAsString
MessagePack.UnpackerConfig withAllowReadingBinaryAsString(boolean enable)
Allows unpackString and unpackRawStringHeader and unpackString to read bin format family (default: true)
-
withActionOnMalformedString
MessagePack.UnpackerConfig withActionOnMalformedString(CodingErrorAction action)
Sets action when encountered a malformed input (default: REPLACE)
-
withActionOnUnmappableString
MessagePack.UnpackerConfig withActionOnUnmappableString(CodingErrorAction action)
Sets action when an unmappable character is found (default: REPLACE)
-
withStringSizeLimit
MessagePack.UnpackerConfig withStringSizeLimit(int bytes)
unpackString size limit (default: Integer.MAX_VALUE).
-
withStringDecoderBufferSize
MessagePack.UnpackerConfig withStringDecoderBufferSize(int bytes)
-
withBufferSize
MessagePack.UnpackerConfig withBufferSize(int bytes)
When a packer is created with newUnpacker(OutputStream) or newUnpacker(WritableByteChannel), the stream will bebuffered with this size of buffer (default: 8192).
-
-
-
-