Package gov.nasa.pds.label.object
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
Clears the content of theTableRecord
object.int
findColumn(java.lang.String name)
Gets the integer index of a field with the given name (1-relative).java.math.BigInteger
getBigInteger(int index)
Gets the field value as a Java BigInteger.java.math.BigInteger
getBigInteger(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.String name)
Gets the short value of a field given the name.java.lang.String
getString(int index)
Gets the string value of a field given the index.java.lang.String
getString(int index, java.nio.charset.Charset charset)
Gets the string value of a field given the index.java.lang.String
getString(java.lang.String name)
Gets the string value of a field given the name.java.lang.String
getString(java.lang.String name, java.nio.charset.Charset charset)
Gets the string value of a field given the name.int
length()
void
setByte(int index, byte value)
Sets one byte value to a field given the index.void
setByte(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.String name, short value)
Sets two bytes containing the short value to a field given the index.void
setString(int index, java.lang.String value)
Sets a string value to a field given the index.void
setString(java.lang.String value)
Sets a String value to the record at the current offset.void
setString(java.lang.String name, java.lang.String value)
Sets a string value to a field given the name.
-
-
-
Method Detail
-
findColumn
int findColumn(java.lang.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(java.lang.String name)
Gets the boolean value of a field given the index.- Parameters:
name
- the field name- Returns:
- the boolean value
- Throws:
java.lang.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:
java.lang.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:
java.lang.IllegalArgumentException
- If cannot convert the number to short
-
getShort
short getShort(java.lang.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:
java.lang.IllegalArgumentException
- If cannot convert the number to byte
-
getByte
byte getByte(java.lang.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:
java.lang.IllegalArgumentException
- If cannot convert the number to longjava.lang.NumberFormatException
- If the number is out of range for a long
-
getLong
long getLong(java.lang.String name)
Gets the long value of a field given the name.- Parameters:
name
- the field name- Returns:
- a long value
-
getBigInteger
java.math.BigInteger getBigInteger(java.lang.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
java.math.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(java.lang.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:
java.lang.IllegalArgumentException
- If cannot convert the number to intjava.lang.NumberFormatException
- If the number is out of range for an int
-
getDouble
double getDouble(java.lang.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:
java.lang.IllegalArgumentException
- If cannot convert the number to double
-
getFloat
float getFloat(java.lang.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:
java.lang.IllegalArgumentException
- If cannot convert the number to float
-
getString
java.lang.String getString(java.lang.String name)
Gets the string value of a field given the name.- Parameters:
name
- the field name- Returns:
- a String value
-
getString
java.lang.String getString(java.lang.String name, java.nio.charset.Charset charset)
Gets the string value of a field given the name.- Parameters:
name
- the field namecharset
- the charset to use.- Returns:
- a String value
-
getString
java.lang.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:
java.lang.IllegalArgumentException
- If data type is not supported
-
getString
java.lang.String getString(int index, java.nio.charset.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:
java.lang.IllegalArgumentException
- If data type is not supported
-
setString
void setString(int index, java.lang.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:
java.lang.IllegalArgumentException
- If the size of the value is greater than the field length
-
setString
void setString(java.lang.String name, java.lang.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 namevalue
- a string value- Throws:
java.lang.IllegalArgumentException
- If the size of the value is greater than field length
-
setString
void setString(java.lang.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(java.lang.String name, int value)
Sets four bytes containing the integer value to a field given the name.- Parameters:
name
- the field namevalue
- 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(java.lang.String name, double value)
Sets eight bytes containing the double value to a field given the name.- Parameters:
name
- the field namevalue
- 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(java.lang.String name, float value)
Sets four bytes containing the float value to a field given the name.- Parameters:
name
- the field namevalue
- 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(java.lang.String name, short value)
Sets two bytes containing the short value to a field given the index.- Parameters:
name
- the field namevalue
- 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(java.lang.String name, byte value)
Sets one byte value to a field given the name.- Parameters:
name
- the field namevalue
- 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(java.lang.String name, long value)
Sets eight bytes containing the long value to the record given the field name.- Parameters:
name
- the field namevalue
- a long value
-
clear
void clear()
Clears the content of theTableRecord
object.
-
length
int length()
-
getLocation
RecordLocation getLocation()
- Returns:
- Gets the record location.
-
setLocation
void setLocation(RecordLocation location)
Sets the record location.- Parameters:
location
- the record location.
-
-