Package gov.nasa.pds.objectAccess.table
Class TableCharacterAdapter
- java.lang.Object
-
- gov.nasa.pds.objectAccess.table.TableCharacterAdapter
-
- All Implemented Interfaces:
TableAdapter
public class TableCharacterAdapter extends java.lang.Object implements TableAdapter
-
-
Constructor Summary
Constructors Constructor Description TableCharacterAdapter(TableCharacter table)
Creates a new instance for a particular table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FieldDescription
getField(int index)
Returns the field at a given index.int
getFieldCount()
Gets the number of fields in each record.char
getFieldDelimiter()
Gets the field delimiter.FieldDescription[]
getFields()
Gets the definitions of fields from the table.java.util.List<FieldDescription>
getFieldsList()
Gets the definitions of fields from the table.int
getMaximumRecordLength()
Gets the maximum length of each record.long
getOffset()
Gets the offset into the data file where the table starts.long
getRecordCount()
Gets the number of records in the table.java.lang.String
getRecordDelimiter()
Gets the record delimiter.int
getRecordLength()
Gets the length of each record.
-
-
-
Constructor Detail
-
TableCharacterAdapter
public TableCharacterAdapter(TableCharacter table) throws InvalidTableException
Creates a new instance for a particular table.- Parameters:
table
- the table- Throws:
InvalidTableException
-
-
Method Detail
-
getRecordCount
public long getRecordCount()
Description copied from interface:TableAdapter
Gets the number of records in the table.- Specified by:
getRecordCount
in interfaceTableAdapter
- Returns:
- the number of records
-
getFieldCount
public int getFieldCount()
Description copied from interface:TableAdapter
Gets the number of fields in each record. TODO This should really be a long value, but this would require a ton of changes in the code so we will attack this problem when we get there. Data with num fields larger than max int should not happen- Specified by:
getFieldCount
in interfaceTableAdapter
- Returns:
- the number of fields
-
getField
public FieldDescription getField(int index)
Description copied from interface:TableAdapter
Returns the field at a given index. This field will be a simple field or a bit field. All grouped fields will have been expanded to their instances.- Specified by:
getField
in interfaceTableAdapter
- Parameters:
index
- the field index- Returns:
- the field description
-
getFields
public FieldDescription[] getFields()
Description copied from interface:TableAdapter
Gets the definitions of fields from the table. The fields will be a simple field or a bit field. All grouped fields will have been expanded to their instances.- Specified by:
getFields
in interfaceTableAdapter
- Returns:
- an array of field descriptions
-
getOffset
public long getOffset()
Description copied from interface:TableAdapter
Gets the offset into the data file where the table starts.- Specified by:
getOffset
in interfaceTableAdapter
- Returns:
- the table offset
-
getRecordLength
public int getRecordLength()
Description copied from interface:TableAdapter
Gets the length of each record. For delimited tables the record length is not defined, so -1 is returned. TODO This should really be a long value, but this would require a ton of changes in the code we will attack this problem when we get there. Data with record length larger than max int should not happen- Specified by:
getRecordLength
in interfaceTableAdapter
- Returns:
- the record length, or zero for a delimited table
-
getRecordDelimiter
public java.lang.String getRecordDelimiter()
Description copied from interface:TableAdapter
Gets the record delimiter. For binary tables the record delimiter is not defined, so null is returned.- Specified by:
getRecordDelimiter
in interfaceTableAdapter
- Returns:
- the record delimiter, or null for binary table
-
getFieldDelimiter
public char getFieldDelimiter()
Description copied from interface:TableAdapter
Gets the field delimiter. For non-delimited tables, will return 0.- Specified by:
getFieldDelimiter
in interfaceTableAdapter
- Returns:
- the field delimiter, or 0 for non-delimited table
-
getFieldsList
public java.util.List<FieldDescription> getFieldsList()
Description copied from interface:TableAdapter
Gets the definitions of fields from the table. The fields will be a simple field or a bit field. All grouped fields will have been expanded to their instances.- Specified by:
getFieldsList
in interfaceTableAdapter
- Returns:
- an array of field descriptions
-
getMaximumRecordLength
public int getMaximumRecordLength()
Description copied from interface:TableAdapter
Gets the maximum length of each record. Optional only for delimited tables. Will return -1 if not available.- Specified by:
getMaximumRecordLength
in interfaceTableAdapter
- Returns:
- the maximum record lengths
-
-