Interface PortableReader


public interface PortableReader
Provides a mean of reading portable fields from a binary in form of java primitives arrays of java primitives, nested portable fields and array of portable fields.

PortableReader read method family support nested paths. For example body.brain.iq is a valid nested path.

  • Method Details

    • getVersion

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

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

      Set<String> getFieldNames()
      Returns:
      set of field names on this portable class
    • getFieldType

      FieldType getFieldType​(String fieldName)
      Parameters:
      fieldName - name of the field
      Returns:
      field type of given fieldName
    • getFieldClassId

      int getFieldClassId​(String fieldName)
      Parameters:
      fieldName - name of the field
      Returns:
      classId of given field
    • readInt

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

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

      String readUTF​(String fieldName) throws IOException
      Parameters:
      fieldName - name of the field
      Returns:
      the utf string value read
      Throws:
      IOException - in case of any exceptional case
    • readBoolean

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

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

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

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

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

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

      <P extends Portable> P readPortable​(String fieldName) throws IOException
      Type Parameters:
      P - the type of the portable read
      Parameters:
      fieldName - name of the field
      Returns:
      the portable value read
      Throws:
      IOException - in case of any exceptional case
    • readByteArray

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

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

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

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

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

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

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

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

      String[] readUTFArray​(String fieldName) throws IOException
      Parameters:
      fieldName - name of the field
      Returns:
      the String array value read
      Throws:
      IOException - in case of any exceptional case
    • readPortableArray

      Portable[] readPortableArray​(String fieldName) throws IOException
      Parameters:
      fieldName - name of the field
      Returns:
      the portable value read
      Throws:
      IOException - in case of any exceptional case
    • getRawDataInput

      ObjectDataInput getRawDataInput() throws IOException
      PortableWriter.getRawDataOutput().

      Note that portable fields can not read after getRawDataInput() is called. In case this happens, IOException will be thrown.

      Returns:
      rawDataInput
      Throws:
      IOException - in case of any exceptional case