org.apache.ignite.binary

## Interface BinaryWriter

All Known Implementing Classes:
  BinaryWriterExImpl

    public interface BinaryWriter

Writer for binary object used in `Binarylizable` implementations. Useful for the cases when user wants a fine-grained control over serialization.

Note that Ignite never writes full strings for field or type names. Instead, for performance reasons, Ignite writes integer hash codes for type and field names. It has been tested that hash code conflicts for the type names or the field names within the same type are virtually non-existent and, to gain performance, it is safe to work with hash codes. For the cases when hash codes for different types or fields actually do collide, Ignite provides `BinaryIdMapper` which allows to override the automatically generated hash code IDs for the type and field names.

### Method Summary

Methods
`BinaryRawWriter` `rawWriter()` Gets raw writer.
`void` `writeBoolean(String fieldName, boolean val)`
`void` `writeBooleanArray(String fieldName, boolean[] val)`
`void` `writeByte(String fieldName, byte val)`
`void` `writeByteArray(String fieldName, byte[] val)`
`void` `writeChar(String fieldName, char val)`
`void` `writeCharArray(String fieldName, char[] val)`
`<T> void` `writeCollection(String fieldName, Collection<T> col)`
`void` `writeDate(String fieldName, Date val)`
`void` `writeDateArray(String fieldName, Date[] val)`
`void` `writeDecimal(String fieldName, BigDecimal val)`
`void` `writeDecimalArray(String fieldName, BigDecimal[] val)`
`void` `writeDouble(String fieldName, double val)`
`void` `writeDoubleArray(String fieldName, double[] val)`
`<T extends Enum<?>> void` `writeEnum(String fieldName, T val)`
`<T extends Enum<?>> void` `writeEnumArray(String fieldName, T[] val)`
`void` `writeFloat(String fieldName, float val)`
`void` `writeFloatArray(String fieldName, float[] val)`
`void` `writeInt(String fieldName, int val)`
`void` `writeIntArray(String fieldName, int[] val)`
`void` `writeLong(String fieldName, long val)`
`void` `writeLongArray(String fieldName, long[] val)`
`<K,V> void` `writeMap(String fieldName, Map<K,V> map)`
`void` `writeObject(String fieldName, Object obj)`
`void` `writeObjectArray(String fieldName, Object[] val)`
`void` `writeShort(String fieldName, short val)`
`void` `writeShortArray(String fieldName, short[] val)`
`void` `writeString(String fieldName, String val)`
`void` `writeStringArray(String fieldName, String[] val)`
`void` `writeTime(String fieldName, Time val)`
`void` `writeTimeArray(String fieldName, Time[] val)`
`void` `writeTimestamp(String fieldName, Timestamp val)`
`void` `writeTimestampArray(String fieldName, Timestamp[] val)`
`void` `writeUuid(String fieldName, UUID val)`
`void` `writeUuidArray(String fieldName, UUID[] val)`

### Method Detail

#### writeByte

    void writeByte(String fieldName,
                 byte val)
                   throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeShort

    void writeShort(String fieldName,
                  short val)
                    throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeInt

    void writeInt(String fieldName,
                int val)
                  throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeLong

    void writeLong(String fieldName,
                 long val)
                   throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeFloat

    void writeFloat(String fieldName,
                  float val)
                    throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeDouble

    void writeDouble(String fieldName,
                   double val)
                     throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeChar

    void writeChar(String fieldName,
                 char val)
                   throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeBoolean

    void writeBoolean(String fieldName,
                    boolean val)
                      throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeDecimal

    void writeDecimal(String fieldName,
                    @Nullable
                    BigDecimal val)
                      throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeString

    void writeString(String fieldName,
                   @Nullable
                   String val)
                     throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeUuid

    void writeUuid(String fieldName,
                 @Nullable
                 UUID val)
                   throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - UUID to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeDate

    void writeDate(String fieldName,
                 @Nullable
                 Date val)
                   throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Date to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeTimestamp

    void writeTimestamp(String fieldName,
                      @Nullable
                      Timestamp val)
                        throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Timestamp to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeTime

    void writeTime(String fieldName,
                 @Nullable
                 Time val)
                   throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Time to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeObject

    void writeObject(String fieldName,
                   @Nullable
                   Object obj)
                     throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `obj` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeByteArray

    void writeByteArray(String fieldName,
                      @Nullable
                      byte[] val)
                        throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeShortArray

    void writeShortArray(String fieldName,
                       @Nullable
                       short[] val)
                         throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeIntArray

    void writeIntArray(String fieldName,
                     @Nullable
                     int[] val)
                       throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeLongArray

    void writeLongArray(String fieldName,
                      @Nullable
                      long[] val)
                        throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeFloatArray

    void writeFloatArray(String fieldName,
                       @Nullable
                       float[] val)
                         throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeDoubleArray

    void writeDoubleArray(String fieldName,
                        @Nullable
                        double[] val)
                          throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeCharArray

    void writeCharArray(String fieldName,
                      @Nullable
                      char[] val)
                        throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeBooleanArray

    void writeBooleanArray(String fieldName,
                         @Nullable
                         boolean[] val)
                           throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeDecimalArray

    void writeDecimalArray(String fieldName,
                         @Nullable
                         BigDecimal[] val)
                           throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeStringArray

    void writeStringArray(String fieldName,
                        @Nullable
                        String[] val)
                          throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeUuidArray

    void writeUuidArray(String fieldName,
                      @Nullable
                      UUID[] val)
                        throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeDateArray

    void writeDateArray(String fieldName,
                      @Nullable
                      Date[] val)
                        throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeTimestampArray

    void writeTimestampArray(String fieldName,
                           @Nullable
                           Timestamp[] val)
                             throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeTimeArray

    void writeTimeArray(String fieldName,
                      @Nullable
                      Time[] val)
                        throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeObjectArray

    void writeObjectArray(String fieldName,
                        @Nullable
                        Object[] val)
                          throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeCollection

    <T> void writeCollection(String fieldName,
                           @Nullable
                           Collection<T> col)
                         throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `col` - Collection to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeMap

    <K,V> void writeMap(String fieldName,
                      @Nullable
                      Map<K,V> map)
                  throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `map` - Map to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeEnum

    <T extends Enum<?>> void writeEnum(String fieldName,
                                     T val)
                   throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### writeEnumArray

    <T extends Enum<?>> void writeEnumArray(String fieldName,
                                          T[] val)
                        throws BinaryObjectException

Parameters:
  `fieldName` - Field name.
  `val` - Value to write.
Throws:
  `BinaryObjectException` - In case of error.

#### rawWriter

    BinaryRawWriter rawWriter()

Gets raw writer. Raw writer does not write field name hash codes, therefore, making the format even more compact. However, if the raw writer is used, dynamic structure changes to the binary objects are not supported.

Returns:
  Raw writer.

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.1.0
Release Date | : July 20 2017