Interface PortableWriter


public interface PortableWriter
Provides means for writing portable fields to binary data in the form of java primitives, arrays of java primitives, nested portable fields and arrays of portable fields.
  • Method Details

    • writeInt

      void writeInt​(@Nonnull 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​(@Nonnull 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

      @Deprecated void writeUTF​(@Nonnull String fieldName, @Nullable String value) throws IOException
      Deprecated.
      for the sake of better naming. Use writeString(String, String) instead.
      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
    • writeString

      void writeString​(@Nonnull String fieldName, @Nullable 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​(@Nonnull 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​(@Nonnull 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​(@Nonnull 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​(@Nonnull 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​(@Nonnull 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​(@Nonnull 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​(@Nonnull String fieldName, @Nullable Portable portable) throws IOException
      Writes a Portable. Use writeNullPortable(String, int, int) to write a null Portable
      Parameters:
      fieldName - name of the field
      portable - Portable to be written
      Throws:
      IOException - in case of any exceptional case
    • writeNullPortable

      void writeNullPortable​(@Nonnull 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
    • writeDecimal

      void writeDecimal​(@Nonnull String fieldName, @Nullable BigDecimal value) throws IOException
      Writes a decimal which is arbitrary precision and scale floating-point number
      Parameters:
      fieldName - name of the field
      value - BigDecimal value to be written
      Throws:
      IOException - in case of any exceptional case
    • writeTime

      void writeTime​(@Nonnull String fieldName, @Nullable LocalTime value) throws IOException
      Write a time field consisting of hour, minute, seconds and nanos parts
      Parameters:
      fieldName - name of the field
      value - LocalTime value to be written
      Throws:
      IOException - in case of any exceptional case
    • writeDate

      void writeDate​(@Nonnull String fieldName, @Nullable LocalDate value) throws IOException
      Writes a date field consisting of year, month of the year and day of the month
      Parameters:
      fieldName - name of the field
      value - LocalDate value to be written
      Throws:
      IOException - in case of any exceptional case
    • writeTimestamp

      void writeTimestamp​(@Nonnull String fieldName, @Nullable LocalDateTime value) throws IOException
      Writes a timestamp field consisting of year, month of the year, day of the month, hour, minute, seconds, nanos parts
      Parameters:
      fieldName - name of the field
      value - LocalDateTime value to be written
      Throws:
      IOException - in case of any exceptional case
    • writeTimestampWithTimezone

      void writeTimestampWithTimezone​(@Nonnull String fieldName, @Nullable OffsetDateTime value) throws IOException
      Writes a timestamp with timezone field consisting of year, month of the year, day of the month, offset seconds, hour, minute, seconds, nanos parts
      Parameters:
      fieldName - name of the field
      value - OffsetDateTime value to be written
      Throws:
      IOException - in case of any exceptional case
    • writeByteArray

      void writeByteArray​(@Nonnull String fieldName, @Nullable 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​(@Nonnull String fieldName, @Nullable 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​(@Nonnull String fieldName, @Nullable 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​(@Nonnull String fieldName, @Nullable 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​(@Nonnull String fieldName, @Nullable 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​(@Nonnull String fieldName, @Nullable 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​(@Nonnull String fieldName, @Nullable 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​(@Nonnull String fieldName, @Nullable 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

      @Deprecated void writeUTFArray​(@Nonnull String fieldName, @Nullable String[] values) throws IOException
      Deprecated.
      for the sake of better naming. Use writeStringArray(String, String[]) instead.
      Writes a String-array.
      Parameters:
      fieldName - name of the field
      values - String array to be written
      Throws:
      IOException - in case of any exceptional case
    • writeStringArray

      void writeStringArray​(@Nonnull String fieldName, @Nullable 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​(@Nonnull String fieldName, @Nullable Portable[] values) throws IOException
      Writes a an array of Portables.
      Parameters:
      fieldName - name of the field
      values - portable array to be written
      Throws:
      IOException - in case of any exceptional case
    • writeDecimalArray

      void writeDecimalArray​(@Nonnull String fieldName, @Nullable BigDecimal[] values) throws IOException
      Writes an array of Decimals
      Parameters:
      fieldName - name of the field
      values - BigDecimal array to be written
      Throws:
      IOException - in case of any exceptional case
      See Also:
      writeDecimal(String, BigDecimal)
    • writeTimeArray

      void writeTimeArray​(@Nonnull String fieldName, @Nullable LocalTime[] values) throws IOException
      Writes an array of Time's
      Parameters:
      fieldName - name of the field
      values - LocalTime array to be written
      Throws:
      IOException - in case of any exceptional case
      See Also:
      writeTime(String, LocalTime)
    • writeDateArray

      void writeDateArray​(@Nonnull String fieldName, @Nullable LocalDate[] values) throws IOException
      Writes an array of Date's
      Parameters:
      fieldName - name of the field
      values - LocalDate array to be written
      Throws:
      IOException - in case of any exceptional case
      See Also:
      writeDate(String, LocalDate)
    • writeTimestampArray

      void writeTimestampArray​(@Nonnull String fieldName, @Nullable LocalDateTime[] values) throws IOException
      Writes an array of Timestamp's
      Parameters:
      fieldName - name of the field
      values - LocalDateTime array to be written
      Throws:
      IOException - in case of any exceptional case
      See Also:
      writeTimestamp(String, LocalDateTime)
    • writeTimestampWithTimezoneArray

      void writeTimestampWithTimezoneArray​(@Nonnull String fieldName, @Nullable OffsetDateTime[] values) throws IOException
      Writes an array of TimestampWithTimezone's
      Parameters:
      fieldName - name of the field
      values - OffsetDateTime array to be written
      Throws:
      IOException - in case of any exceptional case
      See Also:
      writeTimestampWithTimezone(String, OffsetDateTime)
    • getRawDataOutput

      @Nonnull ObjectDataOutput getRawDataOutput() throws IOException
      After writing portable fields one can subsequently write remaining fields in the old-fashioned way. Users should note that after calling this method, trying to write portable fields will result in an IOException.
      Returns:
      ObjectDataOutput
      Throws:
      IOException - in case of any exceptional case