Interface TableRecord

All Known Implementing Classes:
DelimitedTableRecord, FixedTableRecord

public interface TableRecord
Defines an object for table records that can read the field values or write values to the fields given a field name or field index.
  • Method Summary

    Modifier and Type Method Description
    void clear()
    Clears the content of the TableRecord object.
    int findColumn​(String name)
    Gets the integer index of a field with the given name (1-relative).
    BigInteger getBigInteger​(int index)
    Gets the field value as a Java BigInteger.
    BigInteger getBigInteger​(String name)
    Gets the field value as a Java BigInteger.
    boolean getBoolean​(int index)
    Gets the boolean value of a field given the index.
    boolean getBoolean​(String name)
    Gets the boolean value of a field given the index.
    byte getByte​(int index)
    Gets the byte value of a field given the index.
    byte getByte​(String name)
    Gets the byte value of a field given the name.
    double getDouble​(int index)
    Gets the double value of a field given the index.
    double getDouble​(String name)
    Gets the double value of a field given the name.
    float getFloat​(int index)
    Gets the float value of a field given the index.
    float getFloat​(String name)
    Gets the float value of a field given the name.
    int getInt​(int index)
    Gets the integer value of a field given the index.
    int getInt​(String name)
    Gets the integer value of a field given the name.
    RecordLocation getLocation()  
    long getLong​(int index)
    Gets the long value of a field given the index.
    long getLong​(String name)
    Gets the long value of a field given the name.
    short getShort​(int index)
    Gets the short value of a field given the index.
    short getShort​(String name)
    Gets the short value of a field given the name.
    String getString​(int index)
    Gets the string value of a field given the index.
    String getString​(int index, Charset charset)
    Gets the string value of a field given the index.
    String getString​(String name)
    Gets the string value of a field given the name.
    String getString​(String name, Charset charset)
    Gets the string value of a field given the name.
    void setByte​(int index, byte value)
    Sets one byte value to a field given the index.
    void setByte​(String name, byte value)
    Sets one byte value to a field given the name.
    void setDouble​(int index, double value)
    Sets eight bytes containing the double value to a field given the index.
    void setDouble​(String name, double value)
    Sets eight bytes containing the double value to a field given the name.
    void setFloat​(int index, float value)
    Sets four bytes containing the float value to a field given the index.
    void setFloat​(String name, float value)
    Sets four bytes containing the float value to a field given the name.
    void setInt​(int index, int value)
    Sets four bytes containing the integer value to a field given the index.
    void setInt​(String name, int value)
    Sets four bytes containing the integer value to a field given the name.
    void setLocation​(RecordLocation location)
    Sets the record location.
    void setLong​(int index, long value)
    Sets eight bytes containing the long value to the record given the field index.
    void setLong​(String name, long value)
    Sets eight bytes containing the long value to the record given the field name.
    void setShort​(int index, short value)
    Sets two bytes containing the short value to a field given the index.
    void setShort​(String name, short value)
    Sets two bytes containing the short value to a field given the index.
    void setString​(int index, String value)
    Sets a string value to a field given the index.
    void setString​(String value)
    Sets a String value to the record at the current offset.
    void setString​(String name, String value)
    Sets a string value to a field given the name.
  • Method Details

    • findColumn

      int findColumn​(String name)
      Gets the integer index of a field with the given name (1-relative).
      Parameters:
      name - the name of a field
      Returns:
      the integer index of a field (1-relative)
    • getBoolean

      boolean getBoolean​(String name)
      Gets the boolean value of a field given the index.
      Parameters:
      name - the field name
      Returns:
      the boolean value
      Throws:
      IllegalArgumentException - if the value in the field is not a valid boolean value
    • getBoolean

      boolean getBoolean​(int index)
      Gets the boolean value of a field given the index.
      Parameters:
      index - the field index
      Returns:
      the boolean value
      Throws:
      IllegalArgumentException - if the value in the field is not a valid boolean value
    • getShort

      short getShort​(int index)
      Gets the short value of a field given the index.
      Parameters:
      index - the column index (1-relative)
      Returns:
      a short value
      Throws:
      IllegalArgumentException - If cannot convert the number to short
    • getShort

      short getShort​(String name)
      Gets the short value of a field given the name.
      Parameters:
      name - the field name
      Returns:
      a short value
    • getByte

      byte getByte​(int index)
      Gets the byte value of a field given the index.
      Parameters:
      index - the field index (1-relative)
      Returns:
      a byte value
      Throws:
      IllegalArgumentException - If cannot convert the number to byte
    • getByte

      byte getByte​(String name)
      Gets the byte value of a field given the name.
      Parameters:
      name - the field name
      Returns:
      a byte value
    • getLong

      long getLong​(int index)
      Gets the long value of a field given the index.

      It throws NumberFormatException if the number is out of range when converting from ASCII_Integer to long.

      Parameters:
      index - the field index (1-relative)
      Returns:
      a long value
      Throws:
      IllegalArgumentException - If cannot convert the number to long
      NumberFormatException - If the number is out of range for a long
    • getLong

      long getLong​(String name)
      Gets the long value of a field given the name.
      Parameters:
      name - the field name
      Returns:
      a long value
    • getBigInteger

      BigInteger getBigInteger​(String name)
      Gets the field value as a Java BigInteger.
      Parameters:
      name - the name of the field
      Returns:
      the field value, as a BigInteger
    • getBigInteger

      BigInteger getBigInteger​(int index)
      Gets the field value as a Java BigInteger.
      Parameters:
      index - the field index
      Returns:
      the field value, as a BigInteger
    • getInt

      int getInt​(String name)
      Gets the integer value of a field given the name.
      Parameters:
      name - the field name
      Returns:
      an integer value
    • getInt

      int getInt​(int index)
      Gets the integer value of a field given the index.

      It throws NumberFormatException if the number is out of range when converting from ASCII_Integer to int.

      Parameters:
      index - the field index (1-relative)
      Returns:
      an integer value
      Throws:
      IllegalArgumentException - If cannot convert the number to int
      NumberFormatException - If the number is out of range for an int
    • getDouble

      double getDouble​(String name)
      Gets the double value of a field given the name.
      Parameters:
      name - the field name
      Returns:
      a double value
    • getDouble

      double getDouble​(int index)
      Gets the double value of a field given the index.

      If the number is out of range when converting from ASCII_Real to double, the method returns Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY.

      Parameters:
      index - the field index (1-relative)
      Returns:
      a double value
      Throws:
      IllegalArgumentException - If cannot convert the number to double
    • getFloat

      float getFloat​(String name)
      Gets the float value of a field given the name.
      Parameters:
      name - the field name
      Returns:
      a float value
    • getFloat

      float getFloat​(int index)
      Gets the float value of a field given the index.

      If the number is out of range when converting from ASCII_Real to float, the method returns Float.POSITIVE_INFINITY or Float.NEGATIVE_INFINITY.

      Parameters:
      index - the field index (1-relative)
      Returns:
      a float value
      Throws:
      IllegalArgumentException - If cannot convert the number to float
    • getString

      String getString​(String name)
      Gets the string value of a field given the name.
      Parameters:
      name - the field name
      Returns:
      a String value
    • getString

      String getString​(String name, Charset charset)
      Gets the string value of a field given the name.
      Parameters:
      name - the field name
      charset - the charset to use.
      Returns:
      a String value
    • getString

      String getString​(int index)
      Gets the string value of a field given the index.
      Parameters:
      index - the field index (1-relative)
      Returns:
      a String value
      Throws:
      IllegalArgumentException - If data type is not supported
    • getString

      String getString​(int index, Charset charset)
      Gets the string value of a field given the index.
      Parameters:
      index - the field index (1-relative)
      charset - The charset to use.
      Returns:
      a String value
      Throws:
      IllegalArgumentException - If data type is not supported
    • setString

      void setString​(int index, String value)
      Sets a string value to a field given the index. In a fixed-width text file, numeric values are right justified and non-numeric values are left justified.
      Parameters:
      index - the field index (1-relative)
      value - a string value
      Throws:
      IllegalArgumentException - If the size of the value is greater than the field length
    • setString

      void setString​(String name, String value)
      Sets a string value to a field given the name. In a fixed-width text file, numeric values are right justified and non-numeric values are left justified.
      Parameters:
      name - the field name
      value - a string value
      Throws:
      IllegalArgumentException - If the size of the value is greater than field length
    • setString

      void setString​(String value)
      Sets a String value to the record at the current offset. Use this method to write a field delimiter in fixed-width text file.
      Parameters:
      value - a String value
    • setInt

      void setInt​(int index, int value)
      Sets four bytes containing the integer value to a field given the index.
      Parameters:
      index - the field index (1-relative)
      value - an integer value
    • setInt

      void setInt​(String name, int value)
      Sets four bytes containing the integer value to a field given the name.
      Parameters:
      name - the field name
      value - an integer value
    • setDouble

      void setDouble​(int index, double value)
      Sets eight bytes containing the double value to a field given the index.
      Parameters:
      index - the field index (1-relative)
      value - a double value
    • setDouble

      void setDouble​(String name, double value)
      Sets eight bytes containing the double value to a field given the name.
      Parameters:
      name - the field name
      value - a double value
    • setFloat

      void setFloat​(int index, float value)
      Sets four bytes containing the float value to a field given the index.
      Parameters:
      index - the field index (1-relative)
      value - a float value
    • setFloat

      void setFloat​(String name, float value)
      Sets four bytes containing the float value to a field given the name.
      Parameters:
      name - the field name
      value - a float value
    • setShort

      void setShort​(int index, short value)
      Sets two bytes containing the short value to a field given the index.
      Parameters:
      index - the field index (1-relative)
      value - a short value
    • setShort

      void setShort​(String name, short value)
      Sets two bytes containing the short value to a field given the index.
      Parameters:
      name - the field name
      value - a short value
    • setByte

      void setByte​(int index, byte value)
      Sets one byte value to a field given the index.
      Parameters:
      index - the field index (1-relative)
      value - a byte value
    • setByte

      void setByte​(String name, byte value)
      Sets one byte value to a field given the name.
      Parameters:
      name - the field name
      value - a byte value
    • setLong

      void setLong​(int index, long value)
      Sets eight bytes containing the long value to the record given the field index.
      Parameters:
      index - the field index (1-relative)
      value - a long value
    • setLong

      void setLong​(String name, long value)
      Sets eight bytes containing the long value to the record given the field name.
      Parameters:
      name - the field name
      value - a long value
    • clear

      void clear()
      Clears the content of the TableRecord object.
    • getLocation

      RecordLocation getLocation()
      Returns:
      Gets the record location.
    • setLocation

      void setLocation​(RecordLocation location)
      Sets the record location.
      Parameters:
      location - the record location.