Class MessagePack.UnpackerConfig
- java.lang.Object
-
- org.msgpack.core.MessagePack.UnpackerConfig
-
- All Implemented Interfaces:
java.lang.Cloneable
- Enclosing class:
- MessagePack
public static class MessagePack.UnpackerConfig extends java.lang.Object implements java.lang.CloneableMessageUnpacker configuration.
-
-
Constructor Summary
Constructors Constructor Description UnpackerConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessagePack.UnpackerConfigclone()booleanequals(java.lang.Object obj)java.nio.charset.CodingErrorActiongetActionOnMalformedString()java.nio.charset.CodingErrorActiongetActionOnUnmappableString()booleangetAllowReadingBinaryAsString()booleangetAllowReadingStringAsBinary()intgetBufferSize()intgetStringDecoderBufferSize()intgetStringSizeLimit()inthashCode()MessageUnpackernewUnpacker(byte[] contents)Creates an unpacker that deserializes objects from a specified byte array.MessageUnpackernewUnpacker(byte[] contents, int offset, int length)Creates an unpacker that deserializes objects from subarray of a specified byte array.MessageUnpackernewUnpacker(java.io.InputStream in)Creates an unpacker that deserializes objects from a specified input stream.MessageUnpackernewUnpacker(java.nio.ByteBuffer contents)Creates an unpacker that deserializes objects from a specified ByteBuffer.MessageUnpackernewUnpacker(java.nio.channels.ReadableByteChannel channel)Creates an unpacker that deserializes objects from a specified readable channel.MessageUnpackernewUnpacker(MessageBufferInput in)Creates an unpacker that deserializes objects from a specified input.MessagePack.UnpackerConfigwithActionOnMalformedString(java.nio.charset.CodingErrorAction action)Sets action when encountered a malformed input (default: REPLACE)MessagePack.UnpackerConfigwithActionOnUnmappableString(java.nio.charset.CodingErrorAction action)Sets action when an unmappable character is found (default: REPLACE)MessagePack.UnpackerConfigwithAllowReadingBinaryAsString(boolean enable)Allows unpackString and unpackRawStringHeader and unpackString to read bin format family (default: true)MessagePack.UnpackerConfigwithAllowReadingStringAsBinary(boolean enable)Allows unpackBinaryHeader to read str format family (default: true)MessagePack.UnpackerConfigwithBufferSize(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.UnpackerConfigwithStringDecoderBufferSize(int bytes)MessagePack.UnpackerConfigwithStringSizeLimit(int bytes)unpackString size limit (default: Integer.MAX_VALUE).
-
-
-
Method Detail
-
clone
public MessagePack.UnpackerConfig clone()
- Overrides:
clonein classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
newUnpacker
public MessageUnpacker newUnpacker(MessageBufferInput in)
Creates an unpacker that deserializes objects from a specified input.MessageBufferInputis an interface that lets applications customize memory allocation of internal buffer ofMessageUnpacker.- Parameters:
in- The input stream that provides sequence of buffer chunks and optionally reuses them when MessageUnpacker consumed one completely- Returns:
- A new MessageUnpacker instance
-
newUnpacker
public MessageUnpacker newUnpacker(java.io.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 buffering internally.
- Parameters:
in- The input stream that provides sequence of bytes- Returns:
- A new MessageUnpacker instance
-
newUnpacker
public MessageUnpacker newUnpacker(java.nio.channels.ReadableByteChannel channel)
Creates an unpacker that deserializes objects from a specified readable channel.- Parameters:
channel- The input channel that provides sequence of bytes- Returns:
- A new MessageUnpacker instance
-
newUnpacker
public MessageUnpacker newUnpacker(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- Returns:
- A new MessageUnpacker instance that will never throw IOException
-
newUnpacker
public MessageUnpacker newUnpacker(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- Returns:
- A new MessageUnpacker instance that will never throw IOException
-
newUnpacker
public MessageUnpacker newUnpacker(java.nio.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
MessageUnpacker.getTotalReadBytes()to get actual amount of bytes used in ByteBuffer.- Parameters:
contents- The byte buffer that contains packed objects- Returns:
- A new MessageUnpacker instance that will never throw IOException
-
withAllowReadingStringAsBinary
public MessagePack.UnpackerConfig withAllowReadingStringAsBinary(boolean enable)
Allows unpackBinaryHeader to read str format family (default: true)
-
getAllowReadingStringAsBinary
public boolean getAllowReadingStringAsBinary()
-
withAllowReadingBinaryAsString
public MessagePack.UnpackerConfig withAllowReadingBinaryAsString(boolean enable)
Allows unpackString and unpackRawStringHeader and unpackString to read bin format family (default: true)
-
getAllowReadingBinaryAsString
public boolean getAllowReadingBinaryAsString()
-
withActionOnMalformedString
public MessagePack.UnpackerConfig withActionOnMalformedString(java.nio.charset.CodingErrorAction action)
Sets action when encountered a malformed input (default: REPLACE)
-
getActionOnMalformedString
public java.nio.charset.CodingErrorAction getActionOnMalformedString()
-
withActionOnUnmappableString
public MessagePack.UnpackerConfig withActionOnUnmappableString(java.nio.charset.CodingErrorAction action)
Sets action when an unmappable character is found (default: REPLACE)
-
getActionOnUnmappableString
public java.nio.charset.CodingErrorAction getActionOnUnmappableString()
-
withStringSizeLimit
public MessagePack.UnpackerConfig withStringSizeLimit(int bytes)
unpackString size limit (default: Integer.MAX_VALUE).
-
getStringSizeLimit
public int getStringSizeLimit()
-
withStringDecoderBufferSize
public MessagePack.UnpackerConfig withStringDecoderBufferSize(int bytes)
-
getStringDecoderBufferSize
public int getStringDecoderBufferSize()
-
withBufferSize
public 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).
-
getBufferSize
public int getBufferSize()
-
-