Package gov.nasa.pds.objectAccess
Class FixedTableRecord
- java.lang.Object
- 
- gov.nasa.pds.objectAccess.FixedTableRecord
 
- 
- All Implemented Interfaces:
- TableRecord
 
 public class FixedTableRecord extends java.lang.Object implements TableRecord Implements a fixed-width table record.
- 
- 
Constructor SummaryConstructors Constructor Description FixedTableRecord(byte[] value, java.util.Map<java.lang.String,java.lang.Integer> map, FieldDescription[] fields)Creates an instance ofFixedTableRecordfor reading field values of a fixed-width table record.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the content of theTableRecordobject.intfindColumn(java.lang.String name)Gets the integer index of a field with the given name (1-relative).java.math.BigIntegergetBigInteger(int index)Gets the field value as a Java BigInteger.java.math.BigIntegergetBigInteger(java.lang.String name)Gets the field value as a Java BigInteger.booleangetBoolean(int index)Gets the boolean value of a field given the index.booleangetBoolean(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.String name)Gets the short value of a field given the name.java.lang.StringgetString(int index)Gets the string value of a field given the index.java.lang.StringgetString(int index, java.nio.charset.Charset charset)Gets the string value of a field given the index.java.lang.StringgetString(java.lang.String name)Gets the string value of a field given the name.java.lang.StringgetString(java.lang.String name, java.nio.charset.Charset charset)Gets the string value of a field given the name.intlength()voidsetByte(int index, byte value)Sets one byte value to a field given the index.voidsetByte(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.String name, short value)Sets two bytes containing the short value to a field given the index.voidsetString(int index, java.lang.String value)Sets a string value to a field given the index.voidsetString(java.lang.String value)Sets a String value to the record at the current offset.voidsetString(java.lang.String name, java.lang.String value)Sets a string value to a field given the name.
 
- 
- 
- 
Constructor Detail- 
FixedTableRecordpublic FixedTableRecord(byte[] value, java.util.Map<java.lang.String,java.lang.Integer> map, FieldDescription[] fields)Creates 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 Detail- 
lengthpublic int length() - Specified by:
- lengthin interface- TableRecord
 
 - 
findColumnpublic int findColumn(java.lang.String name) Description 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)
 
 - 
getBooleanpublic boolean getBoolean(java.lang.String name) Description 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
 
 - 
getShortpublic short getShort(java.lang.String name) Description 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
 
 - 
getBytepublic byte getByte(java.lang.String name) Description 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
 
 - 
getLongpublic long getLong(java.lang.String name) Description 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
 
 - 
getIntpublic int getInt(java.lang.String name) Description 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
 
 - 
getBigIntegerpublic java.math.BigInteger getBigInteger(java.lang.String name) Description 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
 
 - 
getBigIntegerpublic java.math.BigInteger getBigInteger(int index) Description 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
 
 - 
getDoublepublic double getDouble(java.lang.String name) Description 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
 
 - 
getFloatpublic float getFloat(java.lang.String name) Description 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
 
 - 
getStringpublic java.lang.String getString(java.lang.String name) Description 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
 
 - 
getStringpublic java.lang.String getString(java.lang.String name, java.nio.charset.Charset charset)Description 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
 
 - 
getStringpublic java.lang.String getString(int index) Description 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
 
 - 
getStringpublic java.lang.String getString(int index, java.nio.charset.Charset charset)Description 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
 
 - 
setStringpublic void setString(int index, java.lang.String value)Description 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
 
 - 
setStringpublic void setString(java.lang.String name, java.lang.String value)Description 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
 
 - 
setStringpublic void setString(java.lang.String value) Description 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
 
 - 
setIntpublic void setInt(java.lang.String name, int value)Description 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
 
 - 
setDoublepublic void setDouble(java.lang.String name, double value)Description 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
 
 - 
setFloatpublic void setFloat(java.lang.String name, float value)Description 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
 
 - 
setLongpublic void setLong(java.lang.String name, long value)Description 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
 
 - 
setShortpublic void setShort(java.lang.String name, 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:
- 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
 
 - 
setBytepublic void setByte(java.lang.String name, byte value)Description 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
 
 - 
getLocationpublic RecordLocation getLocation() - Specified by:
- getLocationin interface- TableRecord
- Returns:
- Gets the record location.
 
 - 
setLocationpublic void setLocation(RecordLocation location) Description copied from interface:TableRecordSets the record location.- Specified by:
- setLocationin interface- TableRecord
- Parameters:
- location- the record location.
 
 
- 
 
-