org.apache.ignite.binary

## Interface BinaryWriter

-     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

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `BinaryRawWriter` | `rawWriter()` Gets raw writer.
    `void` | `writeBoolean(String fieldName, boolean val)`
    `void` | `writeBooleanArray(String fieldName, @Nullable boolean[] val)`
    `void` | `writeByte(String fieldName, byte val)`
    `void` | `writeByteArray(String fieldName, @Nullable byte[] val)`
    `void` | `writeChar(String fieldName, char val)`
    `void` | `writeCharArray(String fieldName, @Nullable char[] val)`
    `<T> void` | `writeCollection(String fieldName, @Nullable Collection<T> col)`
    `void` | `writeDate(String fieldName, @Nullable Date val)`
    `void` | `writeDateArray(String fieldName, @Nullable Date[] val)`
    `void` | `writeDecimal(String fieldName, @Nullable BigDecimal val)`
    `void` | `writeDecimalArray(String fieldName, @Nullable BigDecimal[] val)`
    `void` | `writeDouble(String fieldName, double val)`
    `void` | `writeDoubleArray(String fieldName, @Nullable 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, @Nullable float[] val)`
    `void` | `writeInt(String fieldName, int val)`
    `void` | `writeIntArray(String fieldName, @Nullable int[] val)`
    `void` | `writeLong(String fieldName, long val)`
    `void` | `writeLongArray(String fieldName, @Nullable long[] val)`
    `<K,V> void` | `writeMap(String fieldName, @Nullable Map<K,V> map)`
    `void` | `writeObject(String fieldName, @Nullable Object obj)`
    `void` | `writeObjectArray(String fieldName, @Nullable Object[] val)`
    `void` | `writeShort(String fieldName, short val)`
    `void` | `writeShortArray(String fieldName, @Nullable short[] val)`
    `void` | `writeString(String fieldName, @Nullable String val)`
    `void` | `writeStringArray(String fieldName, @Nullable String[] val)`
    `void` | `writeTime(String fieldName, @Nullable Time val)`
    `void` | `writeTimeArray(String fieldName, @Nullable Time[] val)`
    `void` | `writeTimestamp(String fieldName, @Nullable Timestamp val)`
    `void` | `writeTimestampArray(String fieldName, @Nullable Timestamp[] val)`
    `void` | `writeUuid(String fieldName, @Nullable UUID val)`
    `void` | `writeUuidArray(String fieldName, @Nullable 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
                            @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
                           @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
                         @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
                         @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
                              @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
                         @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
                           @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
                              @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
                               @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
                             @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
                              @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
                               @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
                                @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
                              @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
                                 @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
                                 @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
                                @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
                              @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
                              @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
                                   @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
                              @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
                                @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
                                   @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
                              @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.

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.10.0
Release Date | : March 10 2021