com.hazelcast.nio.serialization

## Interface PortableWriter

-     public interface PortableWriter

  Provides a mean of writing portable fields to a binary in form of java primitives arrays of java primitives, nested portable fields and array of portable fields.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `ObjectDataOutput` | `getRawDataOutput()` After writing portable fields, one can write remaining fields in old fashioned way consecutively at the end of stream.
    `void` | `writeBoolean(String fieldName, boolean value)` Writes a primitive boolean.
    `void` | `writeBooleanArray(String fieldName, boolean[] booleans)` Writes a primitive boolean-array.
    `void` | `writeByte(String fieldName, byte value)` Writes a primitive byte.
    `void` | `writeByteArray(String fieldName, byte[] bytes)` Writes a primitive byte-array.
    `void` | `writeChar(String fieldName, int value)` Writes a primitive char.
    `void` | `writeCharArray(String fieldName, char[] chars)` Writes a primitive char-array.
    `void` | `writeDouble(String fieldName, double value)` Writes a primitive double.
    `void` | `writeDoubleArray(String fieldName, double[] values)` Writes a primitive double array.
    `void` | `writeFloat(String fieldName, float value)` Writes a primitive float.
    `void` | `writeFloatArray(String fieldName, float[] values)` Writes a primitive float array.
    `void` | `writeInt(String fieldName, int value)` Writes a primitive int.
    `void` | `writeIntArray(String fieldName, int[] ints)` Writes a primitive int-array.
    `void` | `writeLong(String fieldName, long value)` Writes a primitive long.
    `void` | `writeLongArray(String fieldName, long[] longs)` Writes a primitive long-array.
    `void` | `writeNullPortable(String fieldName, int factoryId, int classId)` To write a null portable value, user needs to provide class and factoryIds of related class.
    `void` | `writePortable(String fieldName, Portable portable)` Writes a Portable.
    `void` | `writePortableArray(String fieldName, Portable[] portables)` Writes a an array of Portables.
    `void` | `writeShort(String fieldName, short value)` Writes a primitive short.
    `void` | `writeShortArray(String fieldName, short[] values)` Writes a primitive short-array.
    `void` | `writeUTF(String fieldName, String value)` Writes an UTF string.
    `void` | `writeUTFArray(String fieldName, String[] values)` Writes a String-array.

- - ### Method Detail

    - #### writeInt

          void writeInt(String fieldName,
                        int value)
                 throws IOException

      Writes a primitive int.
      Parameters:
        `fieldName` - name of the field
        `value` - int value to be written
      Throws:
        `IOException`

    - #### writeLong

          void writeLong(String fieldName,
                         long value)
                  throws IOException

      Writes a primitive long.
      Parameters:
        `fieldName` - name of the field
        `value` - long value to be written
      Throws:
        `IOException`

    - #### writeUTF

          void writeUTF(String fieldName,
                        String value)
                 throws IOException

      Writes an UTF string.
      Parameters:
        `fieldName` - name of the field
        `value` - utf string value to be written
      Throws:
        `IOException`

    - #### writeBoolean

          void writeBoolean(String fieldName,
                            boolean value)
                     throws IOException

      Writes a primitive boolean.
      Parameters:
        `fieldName` - name of the field
        `value` - int value to be written
      Throws:
        `IOException`

    - #### writeByte

          void writeByte(String fieldName,
                         byte value)
                  throws IOException

      Writes a primitive byte.
      Parameters:
        `fieldName` - name of the field
        `value` - int value to be written
      Throws:
        `IOException`

    - #### writeChar

          void writeChar(String fieldName,
                         int value)
                  throws IOException

      Writes a primitive char.
      Parameters:
        `fieldName` - name of the field
        `value` - int value to be written
      Throws:
        `IOException`

    - #### writeDouble

          void writeDouble(String fieldName,
                           double value)
                    throws IOException

      Writes a primitive double.
      Parameters:
        `fieldName` - name of the field
        `value` - int value to be written
      Throws:
        `IOException`

    - #### writeFloat

          void writeFloat(String fieldName,
                          float value)
                   throws IOException

      Writes a primitive float.
      Parameters:
        `fieldName` - name of the field
        `value` - int value to be written
      Throws:
        `IOException`

    - #### writeShort

          void writeShort(String fieldName,
                          short value)
                   throws IOException

      Writes a primitive short.
      Parameters:
        `fieldName` - name of the field
        `value` - int value to be written
      Throws:
        `IOException`

    - #### writePortable

          void writePortable(String fieldName,
                             Portable portable)
                      throws IOException

      Writes a Portable.
      Parameters:
        `fieldName` - name of the field
        `portable` - Portable to be written
      Throws:
        `IOException`

    - #### writeNullPortable

          void writeNullPortable(String fieldName,
                                 int factoryId,
                                 int classId)
                          throws IOException

      To write a null portable value, user needs to provide class and factoryIds of related class.
      Parameters:
        `fieldName` - name of the field
        `factoryId` - factory ID of related portable class
        `classId` - class ID of related portable class
      Throws:
        `IOException`

    - #### writeByteArray

          void writeByteArray(String fieldName,
                              byte[] bytes)
                       throws IOException

      Writes a primitive byte-array.
      Parameters:
        `fieldName` - name of the field
        `bytes` - byte array to be written
      Throws:
        `IOException`

    - #### writeBooleanArray

          void writeBooleanArray(String fieldName,
                                 boolean[] booleans)
                          throws IOException

      Writes a primitive boolean-array.
      Parameters:
        `fieldName` - name of the field
        `booleans` - boolean array to be written
      Throws:
        `IOException`

    - #### writeCharArray

          void writeCharArray(String fieldName,
                              char[] chars)
                       throws IOException

      Writes a primitive char-array.
      Parameters:
        `fieldName` - name of the field
        `chars` - char array to be written
      Throws:
        `IOException`

    - #### writeIntArray

          void writeIntArray(String fieldName,
                             int[] ints)
                      throws IOException

      Writes a primitive int-array.
      Parameters:
        `fieldName` - name of the field
        `ints` - int array to be written
      Throws:
        `IOException`

    - #### writeLongArray

          void writeLongArray(String fieldName,
                              long[] longs)
                       throws IOException

      Writes a primitive long-array.
      Parameters:
        `fieldName` - name of the field
        `longs` - long array to be written
      Throws:
        `IOException`

    - #### writeDoubleArray

          void writeDoubleArray(String fieldName,
                                double[] values)
                         throws IOException

      Writes a primitive double array.
      Parameters:
        `fieldName` - name of the field
        `values` - double array to be written
      Throws:
        `IOException`

    - #### writeFloatArray

          void writeFloatArray(String fieldName,
                               float[] values)
                        throws IOException

      Writes a primitive float array.
      Parameters:
        `fieldName` - name of the field
        `values` - float array to be written
      Throws:
        `IOException`

    - #### writeShortArray

          void writeShortArray(String fieldName,
                               short[] values)
                        throws IOException

      Writes a primitive short-array.
      Parameters:
        `fieldName` - name of the field
        `values` - short array to be written
      Throws:
        `IOException`

    - #### writeUTFArray

          void writeUTFArray(String fieldName,
                             String[] values)
                      throws IOException

      Writes a String-array.
      Parameters:
        `fieldName` - name of the field
        `values` - String array to be written
      Throws:
        `IOException`

    - #### writePortableArray

          void writePortableArray(String fieldName,
                                  Portable[] portables)
                           throws IOException

      Writes a an array of Portables.
      Parameters:
        `fieldName` - name of the field
        `portables` - portable array to be written
      Throws:
        `IOException`

    - #### getRawDataOutput

          ObjectDataOutput getRawDataOutput()
                                     throws IOException

      After writing portable fields, one can write remaining fields in old fashioned way consecutively at the end of stream. User should not that after getting raw dataoutput trying to write portable fields will result in IOException
      Returns:
        ObjectDataOutput
      Throws:
        `IOException`

Copyright © 2019. All rights reserved.