Package uk.ac.starlink.fits
Class AsciiTableStarTable
java.lang.Object
uk.ac.starlink.table.AbstractStarTable
uk.ac.starlink.fits.AsciiTableStarTable
- All Implemented Interfaces:
Closeable
,AutoCloseable
,uk.ac.starlink.table.StarTable
public abstract class AsciiTableStarTable
extends uk.ac.starlink.table.AbstractStarTable
StarTable implementation for FITS (ASCII) TABLE extensions.
- Since:
- 4 Mar 2022
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AsciiTableStarTable
createTable
(FitsHeader hdr, InputFactory inputFact) Creates a table instance from a TABLE HDU.int
uk.ac.starlink.table.ColumnInfo
getColumnInfo
(int icol) protected int[]
Returns the array of column lengths in bytes.protected int[]
Returns the array of column offsets from the start of the row.long
protected int
Returns the length of each row in bytes.protected Object
readCell
(byte[] cellBuf, int icol) Reads the content of a cell of this table from a byte buffer.protected Object[]
readRow
(byte[] rowBuf) Reads the content of a row of this table from a byte buffer.static void
streamStarTable
(FitsHeader hdr, BasicInput input, uk.ac.starlink.table.TableSink sink) Reads a TABLE HDU from a stream and writes the result to a table sink.Methods inherited from class uk.ac.starlink.table.AbstractStarTable
checkedLongToInt, close, getCell, getColumnAuxDataInfos, getName, getParameters, getRow, getRowAccess, getRowSequence, getRowSplittable, getURL, isRandom, setName, setParameters, setURL
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface uk.ac.starlink.table.StarTable
getParameterByName, setParameter
-
Constructor Details
-
AsciiTableStarTable
Constructor.- Parameters:
hdr
- ASCII TABLE extension header- Throws:
IOException
-
-
Method Details
-
getRowCount
public long getRowCount()- Specified by:
getRowCount
in interfaceuk.ac.starlink.table.StarTable
- Specified by:
getRowCount
in classuk.ac.starlink.table.AbstractStarTable
-
getColumnCount
public int getColumnCount()- Specified by:
getColumnCount
in interfaceuk.ac.starlink.table.StarTable
- Specified by:
getColumnCount
in classuk.ac.starlink.table.AbstractStarTable
-
getColumnInfo
public uk.ac.starlink.table.ColumnInfo getColumnInfo(int icol) - Specified by:
getColumnInfo
in interfaceuk.ac.starlink.table.StarTable
- Specified by:
getColumnInfo
in classuk.ac.starlink.table.AbstractStarTable
-
getRowLength
protected int getRowLength()Returns the length of each row in bytes.- Returns:
- row length
-
getColumnOffsets
protected int[] getColumnOffsets()Returns the array of column offsets from the start of the row.- Returns:
- ncol-length array of byte offsets from row start
-
getColumnLengths
protected int[] getColumnLengths()Returns the array of column lengths in bytes.- Returns:
- ncol-length array of field byte lengths
-
readRow
Reads the content of a row of this table from a byte buffer.- Parameters:
rowBuf
- buffer containing rowLeng bytes- Returns:
- ncol-element array of cell values
-
readCell
Reads the content of a cell of this table from a byte buffer.- Parameters:
cellBuf
- buffer containing bytes for column contenticol
- column index- Returns:
- cell value
-
createTable
public static AsciiTableStarTable createTable(FitsHeader hdr, InputFactory inputFact) throws IOException Creates a table instance from a TABLE HDU.- Parameters:
hdr
- FITS header for ASCII tableinputFact
- input factory for Data part of HDU- Returns:
- new table; it will be random-access according to whether the input factory is
- Throws:
IOException
-
streamStarTable
public static void streamStarTable(FitsHeader hdr, BasicInput input, uk.ac.starlink.table.TableSink sink) throws IOException Reads a TABLE HDU from a stream and writes the result to a table sink.- Parameters:
hdr
- FITS header object describing the TABLE extensioninput
- input stream positioned at the start of the data part of the TABLE extensionsink
- destination for the table- Throws:
IOException
-