Package uk.ac.starlink.votable
Interface TabularData
- All Superinterfaces:
AutoCloseable,Closeable
Contains the actual cell contents of a VOTable TABLE element.
The cell data may always be retrieved sequentially from the table
by acquiring a RowSequence object
(method getRowSequence()) -
this allows you to read all the data from the first row to the last.
Multiple RowSequences may be simultaneously active.
In some cases random access may also be available; if isRandom()
returns true, then the getRowAccess(), getRow(long) and
getCell(long, int) methods can be used to retrieve cell values in any order.
The objects retrieved from cells in a given column are of course
determined by the corresponding FIELD element (FieldElement object),
in particular its arraysize and
datatype attributes.
What object is returned from each column is described by the following
rules:
- If the element is a scalar or (fixed-dimension) 1-element array,
a primitive wrapper object (
Integer,Floatetc) will be normally be returned - If the element is an array, a java array of primitives
(
int[],float[]etc) will normally be returned. This is stored in column-major order, where that makes a difference (for arrays with more than one dimension). - Complex types types are treated by adding an extra dimension to the shape of the data, the most rapidly varying, of size 2.
- Character (
charandunicodeChar) arrays are automatically turned into Strings or String arrays, with dimensionality one less than that suggested by thearraysizeattribute - The element may be
null
getContentClass(int) method.- Author:
- Mark Taylor
-
Method Summary
Modifier and TypeMethodDescriptiongetCell(long irow, int icol) Returns the contents of a given table cell (optional).intReturns the number of columns in the table data.Class<?> getContentClass(int icol) Returns a class to which all elements in a given column can be cast.Object[]getRow(long irow) Returns the contents of a given table row (optional).uk.ac.starlink.table.RowAccessReturns an object which can provide random access for the table data.longReturns the number of rows in the table data.uk.ac.starlink.table.RowSequenceReturns an object which can iterate over all the rows in the table data sequentially.booleanisRandom()Indicates whether random access is provided by this table.
-
Method Details
-
getColumnCount
int getColumnCount()Returns the number of columns in the table data.- Returns:
- number of cells in each row
-
getRowCount
long getRowCount()Returns the number of rows in the table data. If this cannot be determined (easily), the value -1 may be returned. The result will always be positive ifisRandom()returns true.- Returns:
- number of rows, or -1 if unknown
-
getContentClass
Returns a class to which all elements in a given column can be cast.- Parameters:
icol- the column (0-based)- Returns:
- a class to which any non-null element returned by this
object in column
icolwill belong
-
getRowSequence
Returns an object which can iterate over all the rows in the table data sequentially. In general the returned object is only safe for use within a single thread.- Returns:
- an object providing sequential access to the data
- Throws:
IOException
-
isRandom
boolean isRandom()Indicates whether random access is provided by this table. Only if the result is true may thegetRow(long)andgetCell(long, int)methods be used.- Returns:
trueiff random access methods are available
-
getRowAccess
Returns an object which can provide random access for the table data. In general the returned object is only safe for use within a single thread.- Returns:
- an object providing random access to the data
- Throws:
IOException- if there is I/O troubleUnsupportedOperationException- ifisRandomreturns false
-
getCell
Returns the contents of a given table cell (optional). The class of the returned object will be compatible with that returned bygetContentClass(icol). Only provided ifgetRandomreturns true.- Parameters:
irow- row indexicol- column index- Returns:
- contents of the cell at
irow,icol - Throws:
IOException- if there is I/O troubleUnsupportedOperationException- ifisRandomreturns false
-
getRow
Returns the contents of a given table row (optional). Only provided ifgetRandomreturns true.- Parameters:
irow- row index- Returns:
- array of objects giving the cells in row
irow(one cell per column) - Throws:
IOException- if there is I/O troubleUnsupportedOperationException- ifisRandomreturns false
-