-
- All Implemented Interfaces:
-
com.batch.android.msgpack.value.ImmutableRawValue,com.batch.android.msgpack.value.ImmutableValue,com.batch.android.msgpack.value.RawValue,com.batch.android.msgpack.value.Value
public abstract class AbstractImmutableRawValue extends AbstractImmutableValue implements ImmutableRawValue
-
-
Constructor Summary
Constructors Constructor Description AbstractImmutableRawValue(Array<byte> data)AbstractImmutableRawValue(String string)
-
Method Summary
Modifier and Type Method Description ImmutableRawValueasRawValue()Returns the value as {@code RawValue}.Array<byte>asByteArray()Returns the value as {@code byte[]}.ByteBufferasByteBuffer()Returns the value as {@code ByteBuffer}.StringasString()Returns the value as {@code String}.StringtoJson()Returns json representation of this Value. StringtoString()-
Methods inherited from class com.batch.android.msgpack.value.impl.AbstractImmutableValue
asArrayValue, asBinaryValue, asBooleanValue, asExtensionValue, asFloatValue, asIntegerValue, asMapValue, asNilValue, asNumberValue, asStringValue, isArrayValue, isBinaryValue, isBooleanValue, isExtensionValue, isFloatValue, isIntegerValue, isMapValue, isNilValue, isNumberValue, isRawValue, isStringValue -
Methods inherited from class com.batch.android.msgpack.value.Value
asArrayValue, asBinaryValue, asBooleanValue, asExtensionValue, asFloatValue, asIntegerValue, asMapValue, asNilValue, asNumberValue, asRawValue, asStringValue, equals, getValueType, immutableValue, writeTo -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
asRawValue
ImmutableRawValue asRawValue()
Returns the value as
{@code RawValue}. Otherwise throws{@code MessageTypeCastException}.Note that you can't use
instanceofor cast((RawValue) thisValue)to check type of a value because type of a mutable value is variable.
-
asByteArray
Array<byte> asByteArray()
Returns the value as
{@code byte[]}.This method copies the byte array.
-
asByteBuffer
ByteBuffer asByteBuffer()
Returns the value as
{@code ByteBuffer}.Returned ByteBuffer is read-only. See also asReadOnlyBuffer.This method doesn't copy the byte array as much as possible.
-
asString
String asString()
Returns the value as
{@code String}.This method throws an exception if the value includes invalid UTF-8 byte sequence.
-
toJson
String toJson()
Returns json representation of this Value.
Following behavior is not configurable at this release and they might be changed at future releases:
- if a key of MapValue is not string, the key is converted to a string using toString method.
- NaN and Infinity of DoubleValue are converted to null.
- ExtensionValue is converted to a 2-element array where first element is a number and second element is the data encoded in hex.
- BinaryValue is converted to a string using UTF-8 encoding. Invalid byte sequence is replaced with
U+FFFD replacement character. - Invalid UTF-8 byte sequences in StringValue is replaced with
U+FFFD replacement character
-
-
-
-