|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnom.tam.fits.Data
nom.tam.fits.BinaryTable
This class defines the methods for accessing FITS binary table data.
| Field Summary | |
(package private) Vector |
columns
The columns of data in the binary table. |
(package private) int[][] |
dimens
The dimensions of each column. |
(package private) byte[] |
hashArea
This is the area in which variable length column data lives. |
(package private) int |
hashPtr
Pointer to the next available byte in the hashArea. |
(package private) Object[] |
modelRow
An example of the structure of a row |
(package private) int[] |
sizes
The sizes of each column (in number of entries per row) |
(package private) ColumnTable |
table
Where the data is actually stored. |
| Fields inherited from class nom.tam.fits.Data |
dataArray |
| Constructor Summary | |
BinaryTable()
Create a null binary table data segment. |
|
BinaryTable(Header myHeader)
Create a binary table from given header information. |
|
BinaryTable(Object[][] data)
Create a binary table from existing data in row order. |
|
| Method Summary | |
void |
addColumn(Object[] o)
Add a column to the end of a table. |
void |
addFlattenedColumn(Object o,
int[] dims)
Add a column where the data is already flattened. |
void |
addRow(Object[] o)
Add a row at the end of the table. |
Column |
addVarData(Object[] data)
Add a variable length column to the data. |
protected void |
expandHashArea(int need)
This routine makes sure the hash area is large enough to fill a given request. |
Class[] |
getBases()
|
Object[] |
getColumn(int col)
Get a given column |
int[][] |
getDimens()
|
Object |
getElement(int i,
int j)
Get a particular element from the table. |
Object |
getFlattenedColumn(int col)
Get a column in flattened format. |
int |
getHeapSize()
|
int |
getNcol()
Get the number of columns in the table. |
int |
getNrow()
Get the number of rows in the table |
Object[] |
getRow(int row)
Get a given row |
int[] |
getSizes()
|
int |
getTrueSize()
Get the size of the data in the HDU sans padding. |
char[] |
getTypes()
|
Object |
getVarData(int col,
Class baseClass,
boolean complex)
Get the data from a variable length column as a two-d primitive array. |
void |
read(BufferedDataInputStream i)
Read a data array into the current object and if needed position to the beginning of the next FITS block. |
protected void |
readTrueData(BufferedDataInputStream i)
Read in the actual data portion. |
void |
setColumn(int col,
Object[] xcol)
Replace a column in the table. |
void |
setElement(int i,
int j,
Object o)
Replace a single element within the table. |
void |
setFlattenedColumn(int col,
Object data)
Set a column with the data already flattened. |
void |
setRow(int row,
Object[] data)
Replace a row in the table. |
protected int |
useModelRow(Object[] model,
int nrow)
Use an example row to determine what the table should look like. |
protected boolean |
validColumn(int j)
Check if the column number is valid. |
protected boolean |
validRow(int i)
Check to see if this is a valid row. |
void |
write(BufferedDataOutputStream os)
Write the data -- including any buffering needed |
protected void |
writeTrueData(BufferedDataOutputStream o)
Write the data including any hash data. |
| Methods inherited from class nom.tam.fits.Data |
getData, getPaddedSize, getPadding |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
byte[] hashArea
int hashPtr
Vector columns
int[] sizes
int[][] dimens
Object[] modelRow
ColumnTable table
| Constructor Detail |
public BinaryTable()
throws FitsException
public BinaryTable(Header myHeader)
throws FitsException
public BinaryTable(Object[][] data)
throws FitsException
data - The data used to initialize the binary table.| Method Detail |
protected int useModelRow(Object[] model,
int nrow)
model - An example of a row. Each element of model should
have the structure of the corresponding element of the row.nrow - The number of rows in the table.
public Object[] getRow(int row)
throws FitsException
row - The index of the row to be returned.
FitsException
public void setRow(int row,
Object[] data)
throws FitsException
row - The index of the row to be replaced.data - The new values for the row.
FitsException - Thrown if the new row cannot
match the existing data.
public void setColumn(int col,
Object[] xcol)
throws FitsException
col - The index of the column to be replaced.xcol - The new data for the column
FitsException - Thrown if the data does not match
the current column description.
public void setFlattenedColumn(int col,
Object data)
throws FitsException
col - The index of the column to be replaced.data - The new data array. This should be a one-d
primitive array.
FitsException - Thrown if the type of length of
the replacement data differs from the
original.
public Object[] getColumn(int col)
throws FitsException
col - The index of the column.
FitsException
public Object getFlattenedColumn(int col)
throws FitsException
col -
FitsException
public Object getElement(int i,
int j)
throws FitsException
i - The row of the element.j - The column of the element.
FitsException
public void addRow(Object[] o)
throws FitsException
o - An array of objects instantiating the data. These
should have the same structure as any existing rows.
FitsException
public void addColumn(Object[] o)
throws FitsException
o - An array of identically structured objects with the
same number of elements as other columns in the table.
FitsException
public void addFlattenedColumn(Object o,
int[] dims)
throws FitsException
o - The new column data. This should be a one-dimensional
primitive array.
FitsExceptionpublic int getNrow()
public int getNcol()
protected boolean validRow(int i)
i - The Java index (first=0) of the row to check.protected boolean validColumn(int j)
j - The Java index (first=0) of the column to check.
public void setElement(int i,
int j,
Object o)
throws FitsException
i - The row of the data.j - The column of the data.o - The replacement data.
FitsExceptionprotected void expandHashArea(int need)
need - The number of bytes needed for the current
hash area request.
protected void writeTrueData(BufferedDataOutputStream o)
throws FitsException
writeTrueData in class Datao - The output stream.
FitsException
public void read(BufferedDataInputStream i)
throws FitsException
Data
read in class Datai - The input data stream
FitsException
protected void readTrueData(BufferedDataInputStream i)
throws FitsException
Data
readTrueData in class Datai - The input stream.
FitsExceptionpublic int getTrueSize()
getTrueSize in class Data
public Column addVarData(Object[] data)
throws FitsException
data - The data comprising the variable length column.
This should be a two dimensional primitive array
(3D for complex data).
Note that it is declared as a one dimensional object
array to make access convenient. Any 2-d array can
be cast to a 1-d array of objects.
FitsException
public Object getVarData(int col,
Class baseClass,
boolean complex)
throws FitsException
col - The index of the column to be returned.baseClass - The base class of the array. It should be one
of the primitive types, e.g, Integer.TYPE.
FitsException
public void write(BufferedDataOutputStream os)
throws FitsException
Data
write in class Dataos - The output stream on which to write the data.
FitsExceptionpublic int getHeapSize()
public int[][] getDimens()
public Class[] getBases()
public char[] getTypes()
public int[] getSizes()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||