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 Details

    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case
    • 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 - in case of any exceptional case