Package 

Class AbstractImmutableRawValue

  • 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
                        
    • Method Summary

      Modifier and Type Method Description
      ImmutableRawValue asRawValue() Returns the value as {@code RawValue}.
      Array<byte> asByteArray() Returns the value as {@code byte[]}.
      ByteBuffer asByteBuffer() Returns the value as {@code ByteBuffer}.
      String asString() Returns the value as {@code String}.
      String toJson() Returns json representation of this Value.
      String toString()
      • 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
    • Constructor Detail

      • AbstractImmutableRawValue

        AbstractImmutableRawValue(Array<byte> data)
      • AbstractImmutableRawValue

        AbstractImmutableRawValue(String string)
    • Method Detail

      • asRawValue

         ImmutableRawValue asRawValue()

        Returns the value as {@code RawValue}. Otherwise throws {@code MessageTypeCastException}.

        Note that you can't use instanceof or 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