Interface PortableReader


  • public interface PortableReader
    Provides means for reading portable fields from binary data in the form of java primitives, arrays of java primitives, nested portable fields and array of portable fields.
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      int getFieldClassId​(java.lang.String fieldName)  
      java.util.Set<java.lang.String> getFieldNames()  
      FieldType getFieldType​(java.lang.String fieldName)  
      ObjectDataInput getRawDataInput()
      int getVersion()  
      boolean hasField​(java.lang.String fieldName)  
      boolean readBoolean​(java.lang.String fieldName)  
      boolean[] readBooleanArray​(java.lang.String fieldName)  
      byte readByte​(java.lang.String fieldName)  
      byte[] readByteArray​(java.lang.String fieldName)  
      char readChar​(java.lang.String fieldName)  
      char[] readCharArray​(java.lang.String fieldName)  
      java.time.LocalDate readDate​(java.lang.String fieldName)
      Reads a date field consisting of year, month of the year and day of the month to LocalDate
      java.time.LocalDate[] readDateArray​(java.lang.String fieldName)
      Reads an array of Date's to LocalDate[]
      java.math.BigDecimal readDecimal​(java.lang.String fieldName)
      Reads a decimal which is arbitrary precision and scale floating-point number to BigDecimal
      java.math.BigDecimal[] readDecimalArray​(java.lang.String fieldName)
      Reads an array of Decimal's to BigDecimal[]
      double readDouble​(java.lang.String fieldName)  
      double[] readDoubleArray​(java.lang.String fieldName)  
      float readFloat​(java.lang.String fieldName)  
      float[] readFloatArray​(java.lang.String fieldName)  
      int readInt​(java.lang.String fieldName)  
      int[] readIntArray​(java.lang.String fieldName)  
      long readLong​(java.lang.String fieldName)  
      long[] readLongArray​(java.lang.String fieldName)  
      <P extends Portable>
      P
      readPortable​(java.lang.String fieldName)  
      Portable[] readPortableArray​(java.lang.String fieldName)  
      short readShort​(java.lang.String fieldName)  
      short[] readShortArray​(java.lang.String fieldName)  
      java.lang.String readString​(java.lang.String fieldName)  
      java.lang.String[] readStringArray​(java.lang.String fieldName)  
      java.time.LocalTime readTime​(java.lang.String fieldName)
      Reads a time field consisting of hour, minute, seconds and nanos parts to LocalTime
      java.time.LocalTime[] readTimeArray​(java.lang.String fieldName)
      Reads an array of Time's to LocalTime[]
      java.time.LocalDateTime readTimestamp​(java.lang.String fieldName)
      Reads a timestamp field consisting of year, month of the year, day of the month, hour, minute, seconds, nanos parts to LocalDateTime
      java.time.LocalDateTime[] readTimestampArray​(java.lang.String fieldName)
      Reads an array of Timestamp's to LocalDateTime[]
      java.time.OffsetDateTime readTimestampWithTimezone​(java.lang.String fieldName)
      Reads a timestamp with timezone field consisting of year, month of the year, day of the month, offset seconds, hour, minute, seconds, nanos parts to OffsetDateTime
      java.time.OffsetDateTime[] readTimestampWithTimezoneArray​(java.lang.String fieldName)
      Reads an array of TimestampWithTimezone's to OffsetDateTime[]
      java.lang.String readUTF​(java.lang.String fieldName)
      Deprecated.
      for the sake of better naming.
      java.lang.String[] readUTFArray​(java.lang.String fieldName)
      Deprecated.
      for the sake of better naming.
    • Method Detail

      • getVersion

        int getVersion()
        Returns:
        global version of portable classes
      • hasField

        boolean hasField​(@Nonnull
                         java.lang.String fieldName)
        Parameters:
        fieldName - name of the field (does not support nested paths)
        Returns:
        true if field exist in this class.
      • getFieldNames

        @Nonnull
        java.util.Set<java.lang.String> getFieldNames()
        Returns:
        set of field names on this portable class
      • getFieldType

        @Nonnull
        FieldType getFieldType​(@Nonnull
                               java.lang.String fieldName)
        Parameters:
        fieldName - name of the field
        Returns:
        field type of given fieldName
        Throws:
        java.lang.IllegalArgumentException - if the field does not exist.
      • getFieldClassId

        int getFieldClassId​(@Nonnull
                            java.lang.String fieldName)
        Parameters:
        fieldName - name of the field
        Returns:
        classId of given field
      • readInt

        int readInt​(@Nonnull
                    java.lang.String fieldName)
             throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the int value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readLong

        long readLong​(@Nonnull
                      java.lang.String fieldName)
               throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the long value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readUTF

        @Nullable
        @Deprecated
        java.lang.String readUTF​(@Nonnull
                                 java.lang.String fieldName)
                          throws java.io.IOException
        Deprecated.
        for the sake of better naming. Use readString(String) instead
        Parameters:
        fieldName - name of the field
        Returns:
        the utf string value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readString

        @Nullable
        java.lang.String readString​(@Nonnull
                                    java.lang.String fieldName)
                             throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the string value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readBoolean

        boolean readBoolean​(@Nonnull
                            java.lang.String fieldName)
                     throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the boolean value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readByte

        byte readByte​(@Nonnull
                      java.lang.String fieldName)
               throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the byte value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readChar

        char readChar​(@Nonnull
                      java.lang.String fieldName)
               throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the char value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readDouble

        double readDouble​(@Nonnull
                          java.lang.String fieldName)
                   throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the double value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readFloat

        float readFloat​(@Nonnull
                        java.lang.String fieldName)
                 throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the float value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readShort

        short readShort​(@Nonnull
                        java.lang.String fieldName)
                 throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the short value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readPortable

        @Nullable
        <P extends Portable> P readPortable​(@Nonnull
                                            java.lang.String fieldName)
                                     throws java.io.IOException
        Type Parameters:
        P - the type of the portable read
        Parameters:
        fieldName - name of the field
        Returns:
        the portable value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readDecimal

        @Nullable
        java.math.BigDecimal readDecimal​(@Nonnull
                                         java.lang.String fieldName)
                                  throws java.io.IOException
        Reads a decimal which is arbitrary precision and scale floating-point number to BigDecimal
        Parameters:
        fieldName - name of the field
        Returns:
        the BigDecimal value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readTime

        @Nullable
        java.time.LocalTime readTime​(@Nonnull
                                     java.lang.String fieldName)
                              throws java.io.IOException
        Reads a time field consisting of hour, minute, seconds and nanos parts to LocalTime
        Parameters:
        fieldName - name of the field
        Returns:
        the LocalTime value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readDate

        @Nullable
        java.time.LocalDate readDate​(@Nonnull
                                     java.lang.String fieldName)
                              throws java.io.IOException
        Reads a date field consisting of year, month of the year and day of the month to LocalDate
        Parameters:
        fieldName - name of the field
        Returns:
        the LocalDate value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readTimestamp

        @Nullable
        java.time.LocalDateTime readTimestamp​(@Nonnull
                                              java.lang.String fieldName)
                                       throws java.io.IOException
        Reads a timestamp field consisting of year, month of the year, day of the month, hour, minute, seconds, nanos parts to LocalDateTime
        Parameters:
        fieldName - name of the field
        Returns:
        the LocalDateTime value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readTimestampWithTimezone

        @Nullable
        java.time.OffsetDateTime readTimestampWithTimezone​(@Nonnull
                                                           java.lang.String fieldName)
                                                    throws java.io.IOException
        Reads a timestamp with timezone field consisting of year, month of the year, day of the month, offset seconds, hour, minute, seconds, nanos parts to OffsetDateTime
        Parameters:
        fieldName - name of the field
        Returns:
        the OffsetDateTime value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readByteArray

        @Nullable
        byte[] readByteArray​(@Nonnull
                             java.lang.String fieldName)
                      throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the byte array value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readBooleanArray

        @Nullable
        boolean[] readBooleanArray​(@Nonnull
                                   java.lang.String fieldName)
                            throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the boolean array value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readCharArray

        @Nullable
        char[] readCharArray​(@Nonnull
                             java.lang.String fieldName)
                      throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the char array value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readIntArray

        @Nullable
        int[] readIntArray​(@Nonnull
                           java.lang.String fieldName)
                    throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the int array value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readLongArray

        @Nullable
        long[] readLongArray​(@Nonnull
                             java.lang.String fieldName)
                      throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the long array value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readDoubleArray

        @Nullable
        double[] readDoubleArray​(@Nonnull
                                 java.lang.String fieldName)
                          throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the double array value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readFloatArray

        @Nullable
        float[] readFloatArray​(@Nonnull
                               java.lang.String fieldName)
                        throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the float array value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readShortArray

        short[] readShortArray​(@Nonnull
                               java.lang.String fieldName)
                        throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the short array value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readUTFArray

        @Nullable
        @Deprecated
        java.lang.String[] readUTFArray​(@Nonnull
                                        java.lang.String fieldName)
                                 throws java.io.IOException
        Deprecated.
        for the sake of better naming. Use readStringArray(String) instead
        Parameters:
        fieldName - name of the field
        Returns:
        the String array value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readStringArray

        @Nullable
        java.lang.String[] readStringArray​(@Nonnull
                                           java.lang.String fieldName)
                                    throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the String array value read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readPortableArray

        @Nullable
        Portable[] readPortableArray​(@Nonnull
                                     java.lang.String fieldName)
                              throws java.io.IOException
        Parameters:
        fieldName - name of the field
        Returns:
        the portable array read
        Throws:
        java.io.IOException - in case of any exceptional case
      • readDecimalArray

        @Nullable
        java.math.BigDecimal[] readDecimalArray​(@Nonnull
                                                java.lang.String fieldName)
                                         throws java.io.IOException
        Reads an array of Decimal's to BigDecimal[]
        Parameters:
        fieldName - name of the field
        Returns:
        the BigDecimal array read
        Throws:
        java.io.IOException - in case of any exceptional case
        See Also:
        readDecimal(String)
      • readTimeArray

        @Nullable
        java.time.LocalTime[] readTimeArray​(@Nonnull
                                            java.lang.String fieldName)
                                     throws java.io.IOException
        Reads an array of Time's to LocalTime[]
        Parameters:
        fieldName - name of the field
        Returns:
        the LocalTime array read
        Throws:
        java.io.IOException - in case of any exceptional case
        See Also:
        readTime(String)
      • readDateArray

        @Nullable
        java.time.LocalDate[] readDateArray​(@Nonnull
                                            java.lang.String fieldName)
                                     throws java.io.IOException
        Reads an array of Date's to LocalDate[]
        Parameters:
        fieldName - name of the field
        Returns:
        the LocalDate array read
        Throws:
        java.io.IOException - in case of any exceptional case
        See Also:
        readDate(String)
      • readTimestampArray

        @Nullable
        java.time.LocalDateTime[] readTimestampArray​(@Nonnull
                                                     java.lang.String fieldName)
                                              throws java.io.IOException
        Reads an array of Timestamp's to LocalDateTime[]
        Parameters:
        fieldName - name of the field
        Returns:
        the LocalDateTime array read
        Throws:
        java.io.IOException - in case of any exceptional case
        See Also:
        readTimestamp(String)
      • readTimestampWithTimezoneArray

        @Nullable
        java.time.OffsetDateTime[] readTimestampWithTimezoneArray​(@Nonnull
                                                                  java.lang.String fieldName)
                                                           throws java.io.IOException
        Reads an array of TimestampWithTimezone's to OffsetDateTime[]
        Parameters:
        fieldName - name of the field
        Returns:
        the OffsetDateTime array read
        Throws:
        java.io.IOException - in case of any exceptional case
        See Also:
        readTimestampWithTimezone(String)
      • getRawDataInput

        @Nonnull
        ObjectDataInput getRawDataInput()
                                 throws java.io.IOException
        PortableWriter.getRawDataOutput().

        Note that portable fields can not be read after this method is called. If this happens, an IOException will be thrown.

        Returns:
        rawDataInput
        Throws:
        java.io.IOException - in case of any exceptional case