public class AsciiTable extends Data implements TableData
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(java.lang.Object newCol)
Add a column to the table.
|
int |
addColumn(java.lang.Object newCol,
int length)
This version of addColumn allows the user to override
the default length associated with each column type.
|
int |
addRow(java.lang.Object[] newRow)
Add a row to the FITS 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.
|
java.lang.Object |
getColumn(int col)
Get a column of data
|
java.lang.Object |
getData()
Get the ASCII table information.
|
java.lang.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
|
java.lang.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,
java.lang.Object newData)
Replace a column with new data.
|
void |
setElement(int row,
int col,
java.lang.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,
java.lang.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(Header hdr) throws FitsException
hdr - The header describing the tableFitsExceptionpublic AsciiTable()
public void read(ArrayDataInput str) throws FitsException
read in interface FitsElementread in class Datastr - FitsExceptionpublic java.lang.Object getData()
throws FitsException
getData in class DataFitsExceptionpublic java.lang.Object getColumn(int col)
throws FitsException
getColumn in interface TableDatacol - The 0-indexed column to be returned.FitsExceptionpublic java.lang.Object[] getRow(int row)
throws FitsException
getRow in interface TableDatarow - The 0-indexed row to be returned.FitsExceptionpublic java.lang.Object getElement(int row,
int col)
throws FitsException
getElement in interface TableDatarow - The 0-based rowcol - The 0-based columnFitsException - when unable to get the data.public 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.public void setColumn(int col,
java.lang.Object newData)
throws FitsException
setColumn in interface TableDatacol - The 0-based index to the columnnewData - The column data. This is typically a 1-d array.FitsExceptionpublic void setRow(int row,
java.lang.Object[] newData)
throws FitsException
setRow in interface TableDatarow - The 0-based index of the rownewData - The new data. Each element of this array is typically
a primitive[1] array.FitsExceptionpublic void setElement(int row,
int col,
java.lang.Object newData)
throws FitsException
setElement in interface TableDatarow - the 0-based rowcol - the 0-based columnnewData - The new value for the column. Typically a primitive[1] array.FitsExceptionpublic 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 boolean isNull(int row,
int col)
row - The 0-based rowcol - The 0-based columnpublic int addColumn(java.lang.Object newCol)
throws FitsException
addColumn in interface TableDatanewCol - the new column information. This is typically a
primitive[n] or String[n] array.FitsExceptionpublic int addColumn(java.lang.Object newCol,
int length)
throws FitsException
newCol - The new column datalength - the requested length for the columnFitsExceptionpublic int addRow(java.lang.Object[] newRow)
throws FitsException
addRow in interface TableDatanewRow - The new row data.FitsExceptionpublic void deleteRows(int start,
int len)
throws FitsException
deleteRows in interface TableDatastart - The first (0-indexed) row to be deleted.len - The number of rows to be deleted.FitsExceptionprotected long getTrueSize()
public void fillHeader(Header hdr)
hdr - The header to be updated with information appropriate
to the current table data.public int getNRows()
public int getNCols()
public int getRowLen()
public void deleteColumns(int start,
int len)
throws FitsException
deleteColumns in interface TableDatastart - The first, 0-indexed, column to be deleted.len - The number of columns to be deleted.FitsExceptionpublic void updateAfterDelete(int oldNCol,
Header hdr)
throws FitsException
updateAfterDelete in interface TableDataoldNCol - The number of columns we had before deletion.hdr - The associated header.FitsException