public interface StarTable
extends java.io.Closeable
ColumnInfo
objects returned by getColumnInfo(int)
.
The first row and the first column are numbered 0.
All StarTable
s allow sequential access, provided by
calling getRowSequence()
. This may in general be
called multiple times so that more than one iteration can be made
through the rows of the table from start to finish.
The getRowSplittable()
method supports multi-threaded
sequential access, and is used by RowRunner
.
Additionally, if the isRandom()
method returns true
then the random access methods getRowAccess()
,
getRow(long)
and getCell(long, int)
may be used to access table contents directly.
For random tables, the getRow
and getCell
methods should be thread-safe. Separate RowSequence
and RowAccess
objects obtained
from the same table should be safely usable from different threads,
but a given RowSequence
/RowAccess
in general will not.
In general it is preferred to use getRowAccess()
than
the equivalent getRow
/getCell
methods
of the table itself, since the assumption of single-threaded use
may permit more efficient implementation.
Modifier and Type | Method and Description |
---|---|
void |
close()
Relinquishes any resources associated with this table.
|
java.lang.Object |
getCell(long irow,
int icol)
Returns the contents of a given table cell.
|
java.util.List<ValueInfo> |
getColumnAuxDataInfos()
Returns an ordered list of ValueInfo objects representing
the auxiliary metadata returned by
getColumnInfo(int).getAuxData() calls. |
int |
getColumnCount()
Returns the number of columns in this table.
|
ColumnInfo |
getColumnInfo(int icol)
Returns the object describing the data in a given column.
|
java.lang.String |
getName()
Returns the name of this table, if it has one.
|
default DescribedValue |
getParameterByName(java.lang.String parname)
Returns a parameter (table-wide metadata item) of this table located
by its name.
|
java.util.List<DescribedValue> |
getParameters()
Returns a list of table parameters, that is metadata items
which pertain to the entire table.
|
java.lang.Object[] |
getRow(long irow)
Returns the contents of a given table row.
|
RowAccess |
getRowAccess()
Returns an object which can provide random access to this
table's data, if random access is implemented.
|
long |
getRowCount()
Returns the number of rows in this table, if known.
|
RowSequence |
getRowSequence()
Returns an object which can iterate over all the rows in the table
sequentially.
|
RowSplittable |
getRowSplittable()
Returns an object which can iterate over all the rows in the table,
but which may also be requested to split recursively
for potentially parallel processing.
|
java.net.URL |
getURL()
Returns the URL of this table, if it has one.
|
boolean |
isRandom()
Indicates whether random access is provided by this table.
|
void |
setName(java.lang.String name)
Sets the name of this table.
|
default void |
setParameter(DescribedValue dval)
Adds the given DescribedValue to the list of parameter metadata objects
associated with this table.
|
void |
setURL(java.net.URL url)
Sets the URL of this table.
|
int getColumnCount()
long getRowCount()
java.net.URL getURL()
null
if none is knownvoid setURL(java.net.URL url)
url
.
If called, the supplied url
should provide the return
value for subsequent calls of getURL()
.url
- table URLjava.lang.String getName()
null
if no suitable one
existsvoid setName(java.lang.String name)
name
should provide the return value for subsequent calls of
getName()
.name
- table namejava.util.List<DescribedValue> getParameters()
List
of DescribedValue
objects
constituting table-wide metadata not covered elsewhere
in this interfacedefault DescribedValue getParameterByName(java.lang.String parname)
null
will be returned.parname
- the name of the table parameter requireddefault void setParameter(DescribedValue dval)
dval
- the new parameter datum to addColumnInfo getColumnInfo(int icol)
icol
- the column for which header information is requiredicol
java.util.List<ValueInfo> getColumnAuxDataInfos()
getColumnInfo(int).getAuxData()
calls.
The idea is that the resulting list can be used to find out
the kind of per-column metadata which can be expected to be found
in some or all columns of this table. Each item in the returned
list should have a unique name, and other characteristics which are
applicable to auxData items which may be returned from any of
the columns in this table.
The order of the list may indicate some sort of natural ordering of these keys. The returned list is not guaranteed to be complete; it is legal to return an empty list if nothing is known about auxiliary metadata. The list ought not to contain duplicate elements.
DefaultValueInfo.getAuxData()
RowSequence getRowSequence() throws java.io.IOException
java.io.IOException
- if there is an error providing accessRowAccess getRowAccess() throws java.io.IOException
java.io.IOException
- if there is an error setting up accessjava.lang.UnsupportedOperationException
- if isRandom
returns
false
RowSplittable getRowSplittable() throws java.io.IOException
The return value must be non-null, and may provide splitting
arrangements specially appropriate for the implementation.
If this table 'wraps' an upstream table, it is usually best to
base the implementation on calls to the the upstream
getRowSplittable
method, so that upstream policy
about how to divide up the table is respected.
However, implementations without special requirements may return
Tables.getDefaultRowSplittable
(this)
.
java.io.IOException
RowRunner
boolean isRandom()
true
may the getRowAccess()
,
getRow(long)
and getCell(long, int)
methods be used.true
if table random access methods are availablejava.lang.Object getCell(long irow, int icol) throws java.io.IOException
getColumnInfo(icol).getContentClass()
.
This method is safe for concurrent use from multiple threads,
but in general it is recommended to use a
RowAccess
instead.
irow
- the index of the cell's rowicol
- the index of the cell's columnjava.io.IOException
- if there is an error reading the datajava.lang.UnsupportedOperationException
- if isRandom
returns
false
java.lang.Object[] getRow(long irow) throws java.io.IOException
getCell(irow,icol)
for all the columns icol
in sequence.
This method is safe for concurrent use from multiple threads,
but in general it is recommended to use a
RowAccess
instead.
irow
- the index of the row to retrieveirow
java.io.IOException
- if there is an error reading the datajava.lang.UnsupportedOperationException
- if isRandom
returns
false
void close() throws java.io.IOException
Following a call to this method, any attempt to use this table or objects such as RowSequences obtained from it will result in undefined behaviour.
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
java.io.IOException