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 Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      ObjectDataOutput getRawDataOutput()
      After writing portable fields one can subsequently write remaining fields in the old-fashioned way.
      void writeBoolean​(java.lang.String fieldName, boolean value)
      Writes a primitive boolean.
      void writeBooleanArray​(java.lang.String fieldName, boolean[] booleans)
      Writes a primitive boolean-array.
      void writeByte​(java.lang.String fieldName, byte value)
      Writes a primitive byte.
      void writeByteArray​(java.lang.String fieldName, byte[] bytes)
      Writes a primitive byte-array.
      void writeChar​(java.lang.String fieldName, int value)
      Writes a primitive char.
      void writeCharArray​(java.lang.String fieldName, char[] chars)
      Writes a primitive char-array.
      void writeDate​(java.lang.String fieldName, java.time.LocalDate value)
      Writes a date field consisting of year, month of the year and day of the month
      void writeDateArray​(java.lang.String fieldName, java.time.LocalDate[] values)
      Writes an array of Date's
      void writeDecimal​(java.lang.String fieldName, java.math.BigDecimal value)
      Writes a decimal which is arbitrary precision and scale floating-point number
      void writeDecimalArray​(java.lang.String fieldName, java.math.BigDecimal[] values)
      Writes an array of Decimals
      void writeDouble​(java.lang.String fieldName, double value)
      Writes a primitive double.
      void writeDoubleArray​(java.lang.String fieldName, double[] values)
      Writes a primitive double array.
      void writeFloat​(java.lang.String fieldName, float value)
      Writes a primitive float.
      void writeFloatArray​(java.lang.String fieldName, float[] values)
      Writes a primitive float array.
      void writeInt​(java.lang.String fieldName, int value)
      Writes a primitive int.
      void writeIntArray​(java.lang.String fieldName, int[] ints)
      Writes a primitive int-array.
      void writeLong​(java.lang.String fieldName, long value)
      Writes a primitive long.
      void writeLongArray​(java.lang.String fieldName, long[] longs)
      Writes a primitive long-array.
      void writeNullPortable​(java.lang.String fieldName, int factoryId, int classId)
      To write a null portable value, user needs to provide class and factoryIds of related class.
      void writePortable​(java.lang.String fieldName, Portable portable)
      Writes a Portable.
      void writePortableArray​(java.lang.String fieldName, Portable[] values)
      Writes a an array of Portables.
      void writeShort​(java.lang.String fieldName, short value)
      Writes a primitive short.
      void writeShortArray​(java.lang.String fieldName, short[] values)
      Writes a primitive short-array.
      void writeString​(java.lang.String fieldName, java.lang.String value)
      Writes an UTF string.
      void writeStringArray​(java.lang.String fieldName, java.lang.String[] values)
      Writes a String-array.
      void writeTime​(java.lang.String fieldName, java.time.LocalTime value)
      Write a time field consisting of hour, minute, seconds and nanos parts
      void writeTimeArray​(java.lang.String fieldName, java.time.LocalTime[] values)
      Writes an array of Time's
      void writeTimestamp​(java.lang.String fieldName, java.time.LocalDateTime value)
      Writes a timestamp field consisting of year, month of the year, day of the month, hour, minute, seconds, nanos parts
      void writeTimestampArray​(java.lang.String fieldName, java.time.LocalDateTime[] values)
      Writes an array of Timestamp's
      void writeTimestampWithTimezone​(java.lang.String fieldName, java.time.OffsetDateTime value)
      Writes a timestamp with timezone field consisting of year, month of the year, day of the month, offset seconds, hour, minute, seconds, nanos parts
      void writeTimestampWithTimezoneArray​(java.lang.String fieldName, java.time.OffsetDateTime[] values)
      Writes an array of TimestampWithTimezone's
      void writeUTF​(java.lang.String fieldName, java.lang.String value)
      Deprecated.
      for the sake of better naming.
      void writeUTFArray​(java.lang.String fieldName, java.lang.String[] values)
      Deprecated.
      for the sake of better naming.
    • Method Detail

      • writeInt

        void writeInt​(@Nonnull
                      java.lang.String fieldName,
                      int value)
               throws java.io.IOException
        Writes a primitive int.
        Parameters:
        fieldName - name of the field
        value - int value to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeLong

        void writeLong​(@Nonnull
                       java.lang.String fieldName,
                       long value)
                throws java.io.IOException
        Writes a primitive long.
        Parameters:
        fieldName - name of the field
        value - long value to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeUTF

        @Deprecated
        void writeUTF​(@Nonnull
                      java.lang.String fieldName,
                      @Nullable
                      java.lang.String value)
               throws java.io.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:
        java.io.IOException - in case of any exceptional case
      • writeString

        void writeString​(@Nonnull
                         java.lang.String fieldName,
                         @Nullable
                         java.lang.String value)
                  throws java.io.IOException
        Writes an UTF string.
        Parameters:
        fieldName - name of the field
        value - utf string value to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeBoolean

        void writeBoolean​(@Nonnull
                          java.lang.String fieldName,
                          boolean value)
                   throws java.io.IOException
        Writes a primitive boolean.
        Parameters:
        fieldName - name of the field
        value - int value to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeByte

        void writeByte​(@Nonnull
                       java.lang.String fieldName,
                       byte value)
                throws java.io.IOException
        Writes a primitive byte.
        Parameters:
        fieldName - name of the field
        value - int value to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeChar

        void writeChar​(@Nonnull
                       java.lang.String fieldName,
                       int value)
                throws java.io.IOException
        Writes a primitive char.
        Parameters:
        fieldName - name of the field
        value - int value to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeDouble

        void writeDouble​(@Nonnull
                         java.lang.String fieldName,
                         double value)
                  throws java.io.IOException
        Writes a primitive double.
        Parameters:
        fieldName - name of the field
        value - int value to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeFloat

        void writeFloat​(@Nonnull
                        java.lang.String fieldName,
                        float value)
                 throws java.io.IOException
        Writes a primitive float.
        Parameters:
        fieldName - name of the field
        value - int value to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeShort

        void writeShort​(@Nonnull
                        java.lang.String fieldName,
                        short value)
                 throws java.io.IOException
        Writes a primitive short.
        Parameters:
        fieldName - name of the field
        value - int value to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writePortable

        void writePortable​(@Nonnull
                           java.lang.String fieldName,
                           @Nullable
                           Portable portable)
                    throws java.io.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:
        java.io.IOException - in case of any exceptional case
      • writeNullPortable

        void writeNullPortable​(@Nonnull
                               java.lang.String fieldName,
                               int factoryId,
                               int classId)
                        throws java.io.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:
        java.io.IOException - in case of any exceptional case
      • writeDecimal

        void writeDecimal​(@Nonnull
                          java.lang.String fieldName,
                          @Nullable
                          java.math.BigDecimal value)
                   throws java.io.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:
        java.io.IOException - in case of any exceptional case
      • writeTime

        void writeTime​(@Nonnull
                       java.lang.String fieldName,
                       @Nullable
                       java.time.LocalTime value)
                throws java.io.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:
        java.io.IOException - in case of any exceptional case
      • writeDate

        void writeDate​(@Nonnull
                       java.lang.String fieldName,
                       @Nullable
                       java.time.LocalDate value)
                throws java.io.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:
        java.io.IOException - in case of any exceptional case
      • writeTimestamp

        void writeTimestamp​(@Nonnull
                            java.lang.String fieldName,
                            @Nullable
                            java.time.LocalDateTime value)
                     throws java.io.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:
        java.io.IOException - in case of any exceptional case
      • writeTimestampWithTimezone

        void writeTimestampWithTimezone​(@Nonnull
                                        java.lang.String fieldName,
                                        @Nullable
                                        java.time.OffsetDateTime value)
                                 throws java.io.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:
        java.io.IOException - in case of any exceptional case
      • writeByteArray

        void writeByteArray​(@Nonnull
                            java.lang.String fieldName,
                            @Nullable
                            byte[] bytes)
                     throws java.io.IOException
        Writes a primitive byte-array.
        Parameters:
        fieldName - name of the field
        bytes - byte array to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeBooleanArray

        void writeBooleanArray​(@Nonnull
                               java.lang.String fieldName,
                               @Nullable
                               boolean[] booleans)
                        throws java.io.IOException
        Writes a primitive boolean-array.
        Parameters:
        fieldName - name of the field
        booleans - boolean array to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeCharArray

        void writeCharArray​(@Nonnull
                            java.lang.String fieldName,
                            @Nullable
                            char[] chars)
                     throws java.io.IOException
        Writes a primitive char-array.
        Parameters:
        fieldName - name of the field
        chars - char array to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeIntArray

        void writeIntArray​(@Nonnull
                           java.lang.String fieldName,
                           @Nullable
                           int[] ints)
                    throws java.io.IOException
        Writes a primitive int-array.
        Parameters:
        fieldName - name of the field
        ints - int array to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeLongArray

        void writeLongArray​(@Nonnull
                            java.lang.String fieldName,
                            @Nullable
                            long[] longs)
                     throws java.io.IOException
        Writes a primitive long-array.
        Parameters:
        fieldName - name of the field
        longs - long array to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeDoubleArray

        void writeDoubleArray​(@Nonnull
                              java.lang.String fieldName,
                              @Nullable
                              double[] values)
                       throws java.io.IOException
        Writes a primitive double array.
        Parameters:
        fieldName - name of the field
        values - double array to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeFloatArray

        void writeFloatArray​(@Nonnull
                             java.lang.String fieldName,
                             @Nullable
                             float[] values)
                      throws java.io.IOException
        Writes a primitive float array.
        Parameters:
        fieldName - name of the field
        values - float array to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeShortArray

        void writeShortArray​(@Nonnull
                             java.lang.String fieldName,
                             @Nullable
                             short[] values)
                      throws java.io.IOException
        Writes a primitive short-array.
        Parameters:
        fieldName - name of the field
        values - short array to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeUTFArray

        @Deprecated
        void writeUTFArray​(@Nonnull
                           java.lang.String fieldName,
                           @Nullable
                           java.lang.String[] values)
                    throws java.io.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:
        java.io.IOException - in case of any exceptional case
      • writeStringArray

        void writeStringArray​(@Nonnull
                              java.lang.String fieldName,
                              @Nullable
                              java.lang.String[] values)
                       throws java.io.IOException
        Writes a String-array.
        Parameters:
        fieldName - name of the field
        values - String array to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writePortableArray

        void writePortableArray​(@Nonnull
                                java.lang.String fieldName,
                                @Nullable
                                Portable[] values)
                         throws java.io.IOException
        Writes a an array of Portables.
        Parameters:
        fieldName - name of the field
        values - portable array to be written
        Throws:
        java.io.IOException - in case of any exceptional case
      • writeDecimalArray

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

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

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

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

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

        @Nonnull
        ObjectDataOutput getRawDataOutput()
                                   throws java.io.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:
        java.io.IOException - in case of any exceptional case