org.apache.ignite.internal.binary

## Class GridBinaryMarshaller

- java.lang.Object
- - org.apache.ignite.internal.binary.GridBinaryMarshaller

    public class GridBinaryMarshaller
    extends Object

Binary objects marshaller.

### Field Summary

Fields
`static byte` `ARR_LIST`
`static byte` `BINARY_ENUM` Binary enum
`static byte` `BINARY_OBJ`
`static byte` `BOOLEAN`
`static byte` `BOOLEAN_ARR`
`static byte` `BYTE`
`static byte` `BYTE_ARR`
`static byte` `CHAR`
`static byte` `CHAR_ARR`
`static byte` `CLASS`
`static byte` `COL`
`static byte` `DATE`
`static byte` `DATE_ARR`
`static byte` `DECIMAL`
`static byte` `DECIMAL_ARR`
`static byte` `DFLT_HDR_LEN`
`static byte` `DOUBLE`
`static byte` `DOUBLE_ARR`
`static byte` `ENUM`
`static byte` `ENUM_ARR`
`static int` `FLAGS_POS` Flags position in header.
`static byte` `FLOAT`
`static byte` `FLOAT_ARR`
`static byte` `HANDLE`
`static int` `HASH_CODE_POS`
`static byte` `HASH_MAP`
`static byte` `HASH_SET`
`static byte` `INT`
`static byte` `INT_ARR`
`static byte` `LINKED_HASH_MAP`
`static byte` `LINKED_HASH_SET`
`static byte` `LINKED_LIST`
`static byte` `LONG`
`static byte` `LONG_ARR`
`static byte` `MAP`
`static byte` `NULL`
`static byte` `OBJ`
`static byte` `OBJ_ARR`
`static int` `OBJECT`
`static byte` `OPTM_MARSH`
`static byte` `PLATFORM_JAVA_OBJECT_FACTORY_PROXY`
`static byte` `PROTO_VER` Protocol version.
`static int` `PROTO_VER_POS` Protocol version position.
`static byte` `PROXY` Proxy.
`static int` `SCHEMA_ID_POS`
`static int` `SCHEMA_OR_RAW_OFF_POS` Schema or raw offset position.
`static byte` `SHORT`
`static byte` `SHORT_ARR`
`static byte` `SINGLETON_LIST`
`static byte` `STRING`
`static byte` `STRING_ARR`
`static byte` `TIME` Time.
`static byte` `TIME_ARR` Time array.
`static byte` `TIMESTAMP` Timestamp.
`static byte` `TIMESTAMP_ARR` Timestamp array.
`static int` `TOTAL_LEN_POS`
`static int` `TYPE_ID_POS`
`static int` `UNREGISTERED_TYPE_ID`
`static byte` `USER_COL`
`static byte` `USER_SET`
`static byte` `UUID`
`static byte` `UUID_ARR`

### Constructor Summary

Constructors
Constructor and Description
`GridBinaryMarshaller(BinaryContext ctx)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`BinaryContext` `context()`
`<T> T` `deserialize(BinaryInputStream in, @Nullable ClassLoader ldr, @Nullable BinaryReaderHandles hnds)`
`<T> T` `deserialize(byte[] arr, @Nullable ClassLoader ldr)`
`byte[]` `marshal(@Nullable Object obj, boolean failIfUnregistered)`
`boolean` `mustDeserialize(Object obj)` Whether object must be deserialized anyway.
`static void` `popContext(@Nullable BinaryContext oldCtx)` Pop binary context and restore the old one.
`BinaryContext` `pushContext()` Push binary context and return the old one.
`BinaryReaderExImpl` `reader(BinaryInputStream stream)` Creates a reader.
`static BinaryContext` `threadLocalContext()`
`<T> T` `unmarshal(BinaryInputStream in)`
`<T> T` `unmarshal(byte[] bytes, @Nullable ClassLoader clsLdr)`
`BinaryWriterExImpl` `writer(BinaryOutputStream out)` Gets writer for the given output stream.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### OPTM_MARSH

    public static final byte OPTM_MARSH

See Also:
  Constant Field Values

#### BYTE

    public static final byte BYTE

See Also:
  Constant Field Values

#### SHORT

    public static final byte SHORT

See Also:
  Constant Field Values

#### INT

    public static final byte INT

See Also:
  Constant Field Values

#### LONG

    public static final byte LONG

See Also:
  Constant Field Values

#### FLOAT

    public static final byte FLOAT

See Also:
  Constant Field Values

#### DOUBLE

    public static final byte DOUBLE

See Also:
  Constant Field Values

#### CHAR

    public static final byte CHAR

See Also:
  Constant Field Values

#### BOOLEAN

    public static final byte BOOLEAN

See Also:
  Constant Field Values

#### DECIMAL

    public static final byte DECIMAL

See Also:
  Constant Field Values

#### STRING

    public static final byte STRING

See Also:
  Constant Field Values

#### UUID

    public static final byte UUID

See Also:
  Constant Field Values

#### DATE

    public static final byte DATE

See Also:
  Constant Field Values

#### BYTE_ARR

    public static final byte BYTE_ARR

See Also:
  Constant Field Values

#### SHORT_ARR

    public static final byte SHORT_ARR

See Also:
  Constant Field Values

#### INT_ARR

    public static final byte INT_ARR

See Also:
  Constant Field Values

#### LONG_ARR

    public static final byte LONG_ARR

See Also:
  Constant Field Values

#### FLOAT_ARR

    public static final byte FLOAT_ARR

See Also:
  Constant Field Values

#### DOUBLE_ARR

    public static final byte DOUBLE_ARR

See Also:
  Constant Field Values

#### CHAR_ARR

    public static final byte CHAR_ARR

See Also:
  Constant Field Values

#### BOOLEAN_ARR

    public static final byte BOOLEAN_ARR

See Also:
  Constant Field Values

#### DECIMAL_ARR

    public static final byte DECIMAL_ARR

See Also:
  Constant Field Values

#### STRING_ARR

    public static final byte STRING_ARR

See Also:
  Constant Field Values

#### UUID_ARR

    public static final byte UUID_ARR

See Also:
  Constant Field Values

#### DATE_ARR

    public static final byte DATE_ARR

See Also:
  Constant Field Values

#### OBJ_ARR

    public static final byte OBJ_ARR

See Also:
  Constant Field Values

#### COL

    public static final byte COL

See Also:
  Constant Field Values

#### MAP

    public static final byte MAP

See Also:
  Constant Field Values

#### BINARY_OBJ

    public static final byte BINARY_OBJ

See Also:
  Constant Field Values

#### ENUM

    public static final byte ENUM

See Also:
  Constant Field Values

#### ENUM_ARR

    public static final byte ENUM_ARR

See Also:
  Constant Field Values

#### CLASS

    public static final byte CLASS

See Also:
  Constant Field Values

#### TIMESTAMP

    public static final byte TIMESTAMP

Timestamp.

See Also:
  Constant Field Values

#### TIMESTAMP_ARR

    public static final byte TIMESTAMP_ARR

Timestamp array.

See Also:
  Constant Field Values

#### PROXY

    public static final byte PROXY

Proxy.

See Also:
  Constant Field Values

#### TIME

    public static final byte TIME

Time.

See Also:
  Constant Field Values

#### TIME_ARR

    public static final byte TIME_ARR

Time array.

See Also:
  Constant Field Values

#### BINARY_ENUM

    public static final byte BINARY_ENUM

Binary enum

See Also:
  Constant Field Values

#### NULL

    public static final byte NULL

See Also:
  Constant Field Values

#### HANDLE

    public static final byte HANDLE

See Also:
  Constant Field Values

#### OBJ

    public static final byte OBJ

See Also:
  Constant Field Values

#### USER_SET

    public static final byte USER_SET

See Also:
  Constant Field Values

#### USER_COL

    public static final byte USER_COL

See Also:
  Constant Field Values

#### ARR_LIST

    public static final byte ARR_LIST

See Also:
  Constant Field Values

#### LINKED_LIST

    public static final byte LINKED_LIST

See Also:
  Constant Field Values

#### HASH_SET

    public static final byte HASH_SET

See Also:
  Constant Field Values

#### LINKED_HASH_SET

    public static final byte LINKED_HASH_SET

See Also:
  Constant Field Values

#### SINGLETON_LIST

    public static final byte SINGLETON_LIST

See Also:
  Constant Field Values

#### HASH_MAP

    public static final byte HASH_MAP

See Also:
  Constant Field Values

#### LINKED_HASH_MAP

    public static final byte LINKED_HASH_MAP

See Also:
  Constant Field Values

#### PLATFORM_JAVA_OBJECT_FACTORY_PROXY

    public static final byte PLATFORM_JAVA_OBJECT_FACTORY_PROXY

See Also:
  Constant Field Values

#### OBJECT

    public static final int OBJECT

See Also:
  Constant Field Values

#### UNREGISTERED_TYPE_ID

    public static final int UNREGISTERED_TYPE_ID

See Also:
  Constant Field Values

#### PROTO_VER

    public static final byte PROTO_VER

Protocol version.

See Also:
  Constant Field Values

#### PROTO_VER_POS

    public static final int PROTO_VER_POS

Protocol version position.

See Also:
  Constant Field Values

#### FLAGS_POS

    public static final int FLAGS_POS

Flags position in header.

See Also:
  Constant Field Values

#### TYPE_ID_POS

    public static final int TYPE_ID_POS

See Also:
  Constant Field Values

#### HASH_CODE_POS

    public static final int HASH_CODE_POS

See Also:
  Constant Field Values

#### TOTAL_LEN_POS

    public static final int TOTAL_LEN_POS

See Also:
  Constant Field Values

#### SCHEMA_ID_POS

    public static final int SCHEMA_ID_POS

See Also:
  Constant Field Values

#### SCHEMA_OR_RAW_OFF_POS

    public static final int SCHEMA_OR_RAW_OFF_POS

Schema or raw offset position.

See Also:
  Constant Field Values

#### DFLT_HDR_LEN

    public static final byte DFLT_HDR_LEN

See Also:
  Constant Field Values

### Constructor Detail

#### GridBinaryMarshaller

    public GridBinaryMarshaller(BinaryContext ctx)

Parameters:
  `ctx` - Context.

### Method Detail

#### marshal

    public byte[] marshal(@Nullable
                          @Nullable Object obj,
                          boolean failIfUnregistered)
                   throws BinaryObjectException

Parameters:
  `obj` - Object to marshal.
  `failIfUnregistered` - Throw exception if class isn't registered.
Returns:
  Byte array.
Throws:
  `BinaryObjectException` - In case of error.

#### unmarshal

    @Nullable
    public <T> T unmarshal(byte[] bytes,
                                     @Nullable
                                     @Nullable ClassLoader clsLdr)
                              throws BinaryObjectException

Parameters:
  `bytes` - Bytes array.
Returns:
  Binary object.
Throws:
  `BinaryObjectException` - In case of error.

#### unmarshal

    @Nullable
    public <T> T unmarshal(BinaryInputStream in)
                              throws BinaryObjectException

Parameters:
  `in` - Input stream.
Returns:
  Binary object.
Throws:
  `BinaryObjectException` - In case of error.

#### deserialize

    @Nullable
    public <T> T deserialize(byte[] arr,
                                       @Nullable
                                       @Nullable ClassLoader ldr)
                                throws BinaryObjectException

Parameters:
  `arr` - Byte array.
  `ldr` - Class loader.
Returns:
  Deserialized object.
Throws:
  `BinaryObjectException` - In case of error.

#### deserialize

    @Nullable
    public <T> T deserialize(BinaryInputStream in,
                                       @Nullable
                                       @Nullable ClassLoader ldr,
                                       @Nullable
                                       @Nullable BinaryReaderHandles hnds)
                                throws BinaryObjectException

Parameters:
  `in` - Input stream.
  `ldr` - Class loader.
  `hnds` - Handles.
Returns:
  Deserialized object.
Throws:
  `BinaryObjectException` - In case of error.

#### pushContext

    public BinaryContext pushContext()

Push binary context and return the old one.

Returns:
  Old binary context.

#### popContext

    public static void popContext(@Nullable
                                  @Nullable BinaryContext oldCtx)

Pop binary context and restore the old one.

Parameters:
  `oldCtx` - Old binary context.

#### reader

    public BinaryReaderExImpl reader(BinaryInputStream stream)

Creates a reader.

Parameters:
  `stream` - Stream.
Returns:
  Reader.

#### mustDeserialize

    public boolean mustDeserialize(Object obj)

Whether object must be deserialized anyway. I.e. it cannot be converted to BinaryObject.

Parameters:
  `obj` - Object.
Returns:
  `True` if object will be deserialized on unmarshal.

#### writer

    public BinaryWriterExImpl writer(BinaryOutputStream out)

Gets writer for the given output stream.

Parameters:
  `out` - Output stream.
Returns:
  Writer.

#### context

    public BinaryContext context()

Returns:
  Context.

#### threadLocalContext

    public static BinaryContext threadLocalContext()

Returns:
  Thread-bound context.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.9.0
Release Date | : October 15 2020