|
|||||||||
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
public class BinaryTable
This class defines the methods for accessing FITS binary table data.
Field Summary |
---|
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(java.lang.Object[][] data)
Create a binary table from existing data in row order. |
Method Summary | |
---|---|
void |
addColumn(java.lang.Object[] o)
Add a column to the end of a table. |
void |
addFlattenedColumn(java.lang.Object o,
int[] dims)
Add a column where the data is already flattened. |
void |
addRow(java.lang.Object[] o)
Add a row at the end of the table. |
Column |
addVarData(java.lang.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. |
java.lang.Class[] |
getBases()
|
java.lang.Object[] |
getColumn(int col)
Get a given column |
int[][] |
getDimens()
|
java.lang.Object |
getElement(int i,
int j)
Get a particular element from the table. |
java.lang.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 |
java.lang.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()
|
java.lang.Object |
getVarData(int col,
java.lang.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,
java.lang.Object[] xcol)
Replace a column in the table. |
void |
setElement(int i,
int j,
java.lang.Object o)
Replace a single element within the table. |
void |
setFlattenedColumn(int col,
java.lang.Object data)
Set a column with the data already flattened. |
void |
setRow(int row,
java.lang.Object[] data)
Replace a row in the table. |
protected int |
useModelRow(java.lang.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 |
Constructor Detail |
---|
public BinaryTable() throws FitsException
FitsException
public BinaryTable(Header myHeader) throws FitsException
header
- A header describing what the binary
table should look like.
FitsException
public BinaryTable(java.lang.Object[][] data) throws FitsException
data
- The data used to initialize the binary table.
FitsException
Method Detail |
---|
protected int useModelRow(java.lang.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 java.lang.Object[] getRow(int row) throws FitsException
row
- The index of the row to be returned.
FitsException
public void setRow(int row, java.lang.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, java.lang.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, java.lang.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 java.lang.Object[] getColumn(int col) throws FitsException
col
- The index of the column.
FitsException
public java.lang.Object getFlattenedColumn(int col) throws FitsException
col
-
FitsException
public java.lang.Object getElement(int i, int j) throws FitsException
i
- The row of the element.j
- The column of the element.
FitsException
public void addRow(java.lang.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(java.lang.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(java.lang.Object o, int[] dims) throws FitsException
o
- The new column data. This should be a one-dimensional
primitive array.dimens
- The dimensions of one row of the column.
FitsException
public 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, java.lang.Object o) throws FitsException
i
- The row of the data.j
- The column of the data.o
- The replacement data.
FitsException
protected 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 Data
o
- The output stream.
FitsException
public void read(BufferedDataInputStream i) throws FitsException
Data
read
in class Data
i
- The input data stream
FitsException
protected void readTrueData(BufferedDataInputStream i) throws FitsException
Data
readTrueData
in class Data
i
- The input stream.
FitsException
public int getTrueSize()
getTrueSize
in class Data
public Column addVarData(java.lang.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 java.lang.Object getVarData(int col, java.lang.Class baseClass, boolean complex) throws FitsException
col
- The index of the column to be returned.newArray
- The array to be filled with variable length data.
This is passed to the BinaryTable class rather than
created here so that we can handle complex data properly.
This will be a two or three dimensional array where the
first dimension is the number of rows in the table.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 Data
os
- The output stream on which to write the data.
FitsException
public int getHeapSize()
public int[][] getDimens()
public java.lang.Class[] getBases()
public char[] getTypes()
public int[] getSizes()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |