Package gov.nasa.pds.objectAccess
Class FixedTableRecord
java.lang.Object
gov.nasa.pds.objectAccess.FixedTableRecord
- All Implemented Interfaces:
- TableRecord
public class FixedTableRecord extends Object implements TableRecord
Implements a fixed-width table record.
- 
Constructor SummaryConstructors Constructor Description FixedTableRecord(byte[] value, Map<String,Integer> map, FieldDescription[] fields)Creates an instance ofFixedTableRecordfor reading field values of a fixed-width table record.
- 
Method SummaryModifier and Type Method Description voidclear()Clears the content of theTableRecordobject.intfindColumn(String name)Gets the integer index of a field with the given name (1-relative).BigIntegergetBigInteger(int index)Gets the field value as a Java BigInteger.BigIntegergetBigInteger(String name)Gets the field value as a Java BigInteger.booleangetBoolean(int index)Gets the boolean value of a field given the index.booleangetBoolean(String name)Gets the boolean value of a field given the index.bytegetByte(int index)Gets the byte value of a field given the index.bytegetByte(String name)Gets the byte value of a field given the name.doublegetDouble(int index)Gets the double value of a field given the index.doublegetDouble(String name)Gets the double value of a field given the name.floatgetFloat(int index)Gets the float value of a field given the index.floatgetFloat(String name)Gets the float value of a field given the name.intgetInt(int index)Gets the integer value of a field given the index.intgetInt(String name)Gets the integer value of a field given the name.RecordLocationgetLocation()longgetLong(int index)Gets the long value of a field given the index.longgetLong(String name)Gets the long value of a field given the name.byte[]getRecordValue()Returns a byte array that stores the record value.shortgetShort(int index)Gets the short value of a field given the index.shortgetShort(String name)Gets the short value of a field given the name.StringgetString(int index)Gets the string value of a field given the index.StringgetString(int index, Charset charset)Gets the string value of a field given the index.StringgetString(String name)Gets the string value of a field given the name.StringgetString(String name, Charset charset)Gets the string value of a field given the name.voidsetByte(int index, byte value)Sets one byte value to a field given the index.voidsetByte(String name, byte value)Sets one byte value to a field given the name.voidsetDouble(int index, double value)Sets eight bytes containing the double value to a field given the index.voidsetDouble(String name, double value)Sets eight bytes containing the double value to a field given the name.voidsetFloat(int index, float value)Sets four bytes containing the float value to a field given the index.voidsetFloat(String name, float value)Sets four bytes containing the float value to a field given the name.voidsetInt(int index, int value)Sets four bytes containing the integer value to a field given the index.voidsetInt(String name, int value)Sets four bytes containing the integer value to a field given the name.voidsetLocation(RecordLocation location)Sets the record location.voidsetLong(int index, long value)Sets eight bytes containing the long value to the record given the field index.voidsetLong(String name, long value)Sets eight bytes containing the long value to the record given the field name.voidsetRecordValue(byte[] value)Sets the record value.voidsetShort(int index, short value)Sets two bytes containing the short value to a field given the index.voidsetShort(String name, short value)Sets two bytes containing the short value to a field given the index.voidsetString(int index, String value)Sets a string value to a field given the index.voidsetString(String value)Sets a String value to the record at the current offset.voidsetString(String name, String value)Sets a string value to a field given the name.
- 
Constructor Details- 
FixedTableRecordCreates an instance ofFixedTableRecordfor reading field values of a fixed-width table record.- Parameters:
- value- the record value
- map- a hash mapping field name to field index
- fields- an array of field descriptions (field meta data)
 
 
- 
- 
Method Details- 
findColumnDescription copied from interface:TableRecordGets the integer index of a field with the given name (1-relative).- Specified by:
- findColumnin interface- TableRecord
- Parameters:
- name- the name of a field
- Returns:
- the integer index of a field (1-relative)
 
- 
getBooleanDescription copied from interface:TableRecordGets the boolean value of a field given the index.- Specified by:
- getBooleanin interface- TableRecord
- Parameters:
- name- the field name
- Returns:
- the boolean value
 
- 
getBooleanpublic boolean getBoolean(int index)Description copied from interface:TableRecordGets the boolean value of a field given the index.- Specified by:
- getBooleanin interface- TableRecord
- Parameters:
- index- the field index
- Returns:
- the boolean value
 
- 
getShortpublic short getShort(int index)Description copied from interface:TableRecordGets the short value of a field given the index.- Specified by:
- getShortin interface- TableRecord
- Parameters:
- index- the column index (1-relative)
- Returns:
- a short value
 
- 
getShortDescription copied from interface:TableRecordGets the short value of a field given the name.- Specified by:
- getShortin interface- TableRecord
- Parameters:
- name- the field name
- Returns:
- a short value
 
- 
getBytepublic byte getByte(int index)Description copied from interface:TableRecordGets the byte value of a field given the index.- Specified by:
- getBytein interface- TableRecord
- Parameters:
- index- the field index (1-relative)
- Returns:
- a byte value
 
- 
getByteDescription copied from interface:TableRecordGets the byte value of a field given the name.- Specified by:
- getBytein interface- TableRecord
- Parameters:
- name- the field name
- Returns:
- a byte value
 
- 
getLongpublic long getLong(int index)Description copied from interface:TableRecordGets 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. - Specified by:
- getLongin interface- TableRecord
- Parameters:
- index- the field index (1-relative)
- Returns:
- a long value
 
- 
getLongDescription copied from interface:TableRecordGets the long value of a field given the name.- Specified by:
- getLongin interface- TableRecord
- Parameters:
- name- the field name
- Returns:
- a long value
 
- 
getIntDescription copied from interface:TableRecordGets the integer value of a field given the name.- Specified by:
- getIntin interface- TableRecord
- Parameters:
- name- the field name
- Returns:
- an integer value
 
- 
getIntpublic int getInt(int index)Description copied from interface:TableRecordGets 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. - Specified by:
- getIntin interface- TableRecord
- Parameters:
- index- the field index (1-relative)
- Returns:
- an integer value
 
- 
getBigIntegerDescription copied from interface:TableRecordGets the field value as a Java BigInteger.- Specified by:
- getBigIntegerin interface- TableRecord
- Parameters:
- name- the name of the field
- Returns:
- the field value, as a BigInteger
 
- 
getBigIntegerDescription copied from interface:TableRecordGets the field value as a Java BigInteger.- Specified by:
- getBigIntegerin interface- TableRecord
- Parameters:
- index- the field index
- Returns:
- the field value, as a BigInteger
 
- 
getDoubleDescription copied from interface:TableRecordGets the double value of a field given the name.- Specified by:
- getDoublein interface- TableRecord
- Parameters:
- name- the field name
- Returns:
- a double value
 
- 
getDoublepublic double getDouble(int index)Description copied from interface:TableRecordGets 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. - Specified by:
- getDoublein interface- TableRecord
- Parameters:
- index- the field index (1-relative)
- Returns:
- a double value
 
- 
getFloatDescription copied from interface:TableRecordGets the float value of a field given the name.- Specified by:
- getFloatin interface- TableRecord
- Parameters:
- name- the field name
- Returns:
- a float value
 
- 
getFloatpublic float getFloat(int index)Description copied from interface:TableRecordGets 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. - Specified by:
- getFloatin interface- TableRecord
- Parameters:
- index- the field index (1-relative)
- Returns:
- a float value
 
- 
getStringDescription copied from interface:TableRecordGets the string value of a field given the name.- Specified by:
- getStringin interface- TableRecord
- Parameters:
- name- the field name
- Returns:
- a String value
 
- 
getStringDescription copied from interface:TableRecordGets the string value of a field given the name.- Specified by:
- getStringin interface- TableRecord
- Parameters:
- name- the field name
- charset- the charset to use.
- Returns:
- a String value
 
- 
getStringDescription copied from interface:TableRecordGets the string value of a field given the index.- Specified by:
- getStringin interface- TableRecord
- Parameters:
- index- the field index (1-relative)
- Returns:
- a String value
 
- 
getStringDescription copied from interface:TableRecordGets the string value of a field given the index.- Specified by:
- getStringin interface- TableRecord
- Parameters:
- index- the field index (1-relative)
- charset- The charset to use.
- Returns:
- a String value
 
- 
setStringDescription copied from interface:TableRecordSets 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.- Specified by:
- setStringin interface- TableRecord
- Parameters:
- index- the field index (1-relative)
- value- a string value
 
- 
setStringDescription copied from interface:TableRecordSets 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.- Specified by:
- setStringin interface- TableRecord
- Parameters:
- name- the field name
- value- a string value
 
- 
setStringDescription copied from interface:TableRecordSets a String value to the record at the current offset. Use this method to write a field delimiter in fixed-width text file.- Specified by:
- setStringin interface- TableRecord
- Parameters:
- value- a String value
 
- 
setIntpublic void setInt(int index, int value)Description copied from interface:TableRecordSets four bytes containing the integer value to a field given the index.- Specified by:
- setIntin interface- TableRecord
- Parameters:
- index- the field index (1-relative)
- value- an integer value
 
- 
setIntDescription copied from interface:TableRecordSets four bytes containing the integer value to a field given the name.- Specified by:
- setIntin interface- TableRecord
- Parameters:
- name- the field name
- value- an integer value
 
- 
setDoublepublic void setDouble(int index, double value)Description copied from interface:TableRecordSets eight bytes containing the double value to a field given the index.- Specified by:
- setDoublein interface- TableRecord
- Parameters:
- index- the field index (1-relative)
- value- a double value
 
- 
setDoubleDescription copied from interface:TableRecordSets eight bytes containing the double value to a field given the name.- Specified by:
- setDoublein interface- TableRecord
- Parameters:
- name- the field name
- value- a double value
 
- 
setFloatpublic void setFloat(int index, float value)Description copied from interface:TableRecordSets four bytes containing the float value to a field given the index.- Specified by:
- setFloatin interface- TableRecord
- Parameters:
- index- the field index (1-relative)
- value- a float value
 
- 
setFloatDescription copied from interface:TableRecordSets four bytes containing the float value to a field given the name.- Specified by:
- setFloatin interface- TableRecord
- Parameters:
- name- the field name
- value- a float value
 
- 
setLongpublic void setLong(int index, long value)Description copied from interface:TableRecordSets eight bytes containing the long value to the record given the field index.- Specified by:
- setLongin interface- TableRecord
- Parameters:
- index- the field index (1-relative)
- value- a long value
 
- 
setLongDescription copied from interface:TableRecordSets eight bytes containing the long value to the record given the field name.- Specified by:
- setLongin interface- TableRecord
- Parameters:
- name- the field name
- value- a long value
 
- 
setShortpublic void setShort(int index, short value)Description copied from interface:TableRecordSets two bytes containing the short value to a field given the index.- Specified by:
- setShortin interface- TableRecord
- Parameters:
- index- the field index (1-relative)
- value- a short value
 
- 
setShortDescription copied from interface:TableRecordSets two bytes containing the short value to a field given the index.- Specified by:
- setShortin interface- TableRecord
- Parameters:
- name- the field name
- value- a short value
 
- 
setBytepublic void setByte(int index, byte value)Description copied from interface:TableRecordSets one byte value to a field given the index.- Specified by:
- setBytein interface- TableRecord
- Parameters:
- index- the field index (1-relative)
- value- a byte value
 
- 
setByteDescription copied from interface:TableRecordSets one byte value to a field given the name.- Specified by:
- setBytein interface- TableRecord
- Parameters:
- name- the field name
- value- a byte value
 
- 
clearpublic void clear()Description copied from interface:TableRecordClears the content of theTableRecordobject.- Specified by:
- clearin interface- TableRecord
 
- 
setRecordValuepublic void setRecordValue(byte[] value)Sets the record value.- Parameters:
- value- byte array that contains the record value
 
- 
getRecordValuepublic byte[] getRecordValue()Returns a byte array that stores the record value.- Returns:
- a byte array that contains the record value
 
- 
getLocation- Specified by:
- getLocationin interface- TableRecord
- Returns:
- Gets the record location.
 
- 
setLocationDescription copied from interface:TableRecordSets the record location.- Specified by:
- setLocationin interface- TableRecord
- Parameters:
- location- the record location.
 
 
-