public class AsciiTable extends AbstractTableData
dataSize, fileOffset, input| Constructor and Description |
|---|
AsciiTable()
Create an empty ASCII table
|
AsciiTable(Header hdr)
Create an ASCII table given a header
|
| Modifier and Type | Method and Description |
|---|---|
int |
addColumn(Object newCol)
Add a column to the table without any associated header information.
|
int |
addColumn(Object newCol,
int length)
This version of addColumn allows the user to override the default length
associated with each column type.
|
int |
addRow(Object[] newRow)
Add a row at the end of the table.
|
void |
deleteColumns(int start,
int len)
Delete columns from the table.
|
void |
deleteRows(int start,
int len)
Delete rows from a FITS table
|
void |
fillHeader(Header hdr)
Fill in a header with information that points to this data.
|
Object |
getColumn(int col)
Get a column of data
|
Object |
getData()
Get the ASCII table information.
|
Object |
getElement(int row,
int col)
Get a single element as a one-d array.
|
int |
getNCols()
Get the number of columns in the table
|
int |
getNRows()
Get the number of rows in the table
|
Object[] |
getRow(int row)
Get a row.
|
int |
getRowLen()
Get the number of bytes in a row
|
protected long |
getTrueSize()
Return the size of the data section
|
boolean |
isNull(int row,
int col)
See if an element is null.
|
void |
read(ArrayDataInput str)
Read in an ASCII table.
|
void |
setColumn(int col,
Object newData)
Replace a column with new data.
|
void |
setElement(int row,
int col,
Object newData)
Modify an element in the table
|
void |
setNull(int row,
int col,
boolean flag)
Mark (or unmark) an element as null.
|
void |
setRow(int row,
Object[] newData)
Modify a row in the table
|
void |
updateAfterDelete(int oldNCol,
Header hdr)
This is called after we delete columns.
|
void |
write(ArrayDataOutput str)
Write the data to an output stream.
|
getFileOffset, getKernel, getSize, reset, rewrite, rewriteable, setFileOffsetpublic AsciiTable()
public AsciiTable(Header hdr) throws FitsException
hdr - The header describing the tableFitsException - if the operation failedpublic int addColumn(Object newCol) throws FitsException
TableDatanewCol - the new column information. the newCol should be an Object[]
where type of all of the constituents is identical. The length
of data should match the other columns. Note: It is
valid for data to be a 2 or higher dimensionality primitive
array. In this case the column index is the first (in Java
speak) index of the array. E.g., if called with
int[30][20][10], the number of rows in the table should be 30
and this column will have elements which are 2-d integer
arrays with TDIM = (10,20).FitsException - if the operation failedpublic int addColumn(Object newCol, int length) throws FitsException
newCol - The new column datalength - the requested length for the columnFitsException - if the operation failedpublic int addRow(Object[] newRow) throws FitsException
TableDatanewRow - An array of elements to be added. Each element of o should be
an array of primitives or a String.FitsException - if the operation failedpublic void deleteColumns(int start,
int len)
throws FitsException
start - The first, 0-indexed, column to be deleted.len - The number of columns to be deleted.FitsException - if the operation failedpublic void deleteRows(int start,
int len)
throws FitsException
start - The first (0-indexed) row to be deleted.len - The number of rows to be deleted.FitsException - if the operation failedpublic void fillHeader(Header hdr)
hdr - The header to be updated with information appropriate to the
current table data.public Object getColumn(int col) throws FitsException
col - The 0-indexed column to be returned.FitsException - if the operation failedpublic Object getData() throws FitsException
getData in class DataFitsException - if the operation failedpublic Object getElement(int row, int col) throws FitsException
row - The 0-based rowcol - The 0-based columnFitsException - when unable to get the data.public int getNCols()
public int getNRows()
public Object[] getRow(int row) throws FitsException
row - The 0-indexed row to be returned.FitsException - if the operation failedpublic int getRowLen()
protected long getTrueSize()
public boolean isNull(int row,
int col)
row - The 0-based rowcol - The 0-based columnpublic void read(ArrayDataInput str) throws FitsException
read in interface FitsElementread in class Datastr - the stream to read fromFitsException - if the operation failedpublic void setColumn(int col,
Object newData)
throws FitsException
col - The 0-based index to the columnnewData - The column data. This is typically a 1-d array.FitsException - if the operation failedpublic void setElement(int row,
int col,
Object newData)
throws FitsException
row - the 0-based rowcol - the 0-based columnnewData - The new value for the column. Typically a primitive[1] array.FitsException - if the operation failedpublic void setNull(int row,
int col,
boolean flag)
row - The 0-based row.col - The 0-based column.flag - True if the element is to be set to null.public void setRow(int row,
Object[] newData)
throws FitsException
row - The 0-based index of the rownewData - The new data. Each element of this array is typically a
primitive[1] array.FitsException - if the operation failedpublic void updateAfterDelete(int oldNCol,
Header hdr)
throws FitsException
oldNCol - The number of columns we had before deletion.hdr - The associated header. @throws FitsException if the operation
failedFitsExceptionpublic void write(ArrayDataOutput str) throws FitsException
write in interface FitsElementwrite in class Datastr - The output stream to be written toFitsException - if any IO exception is found or some inconsistency the FITS
file arises.Copyright © 1996–2018 nom-tam-fits. All rights reserved.