Class CompressedTableData
- All Implemented Interfaces:
Cloneable, FitsElement, TableData
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class BinaryTable
BinaryTable.ColumnDescModifier and TypeClassDescriptionstatic classDescribes the data type and shape stored in a binary table column. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new empty compressed table data to be initialized at a later pointCompressedTableData(Header header) Creates a new compressed table data based on the prescription of the supplied header. -
Method Summary
Modifier and TypeMethodDescriptionvoid(for internal use) This should only be called byCompressedTableHDU, and should have reduced visibility accordingly.longDefragments the heap area of this table, compacting the heap area, and returning the number of bytes by which the heap size has been reduced.voidfillHeader(Header h) voidprepareUncompressedData(ColumnTable<?> data) Deprecated.Methods inherited from class BinaryTable
addBitsColumn, addColumn, addColumn, addComplexColumn, addFlattenedColumn, addRow, addStringColumn, addVariableSizeColumn, compact, containsHeap, convertToBits, copy, createColumnDataFor, deleteColumns, deleteRows, fromColumnMajor, fromRowMajor, get, getArrayElement, getArrayElementAs, getBases, getColumn, getData, getDescriptor, getDescriptor, getDescriptor, getDimens, getDouble, getElement, getFlatColumns, getFlattenedColumn, getLogical, getLong, getModelRow, getNCols, getNRows, getNumber, getRawElement, getRow, getSizes, getString, getTypes, indexOf, parseTDims, read, reserveHeapSpace, reserveRowSpace, set, setColumn, setComplexColumn, setElement, setFlattenedColumn, setRow, toHDU, updateAfterDelete, writeModifier and TypeMethodDescriptionintAdds a column of bits.intAdds a new column with the specified data array, with some default mappings.intaddColumn(BinaryTable.ColumnDesc descriptor) Adds a new empty column to the table to the specification.intaddComplexColumn(Object o, Class<?> decimalType) Adds a column of complex values stored as the specified decimal type of components in the FITS.intaddFlattenedColumn(Object o, int... dims) Deprecated.(for internal use) No longer used, will be removed in the futureintAdds a row to the table.intaddStringColumn(String[] o) Adds a column of string values (one per row), optimized for storage size.intAdds a new variable-length data column, populating it with the specified data object.voidcompact()Discard the information about the original heap size (if this table was read from an input), and instead use the real size of the actual heap (plus reserved space around it) when writing to an output.final booleanChecks if this table contains a heap for storing variable length arrays (VLAs).booleanconvertToBits(int col) Converts a column from FITS logical values to bits.copy()Returns an independent copy of the binary table.static voidcreateColumnDataFor(BinaryTable table) Deprecated.(for internal use) It may become a private method in the future.voiddeleteColumns(int start, int len) Removes a set of consecutive columns from this table, without updating assocu=iated the header information for the columns that were removed.voiddeleteRows(int row, int len) Removes a set of consecutive rows from this table without updating any associated header information for an encompassing HDU.static BinaryTablefromColumnMajor(Object[] columns) Creates a binary table from existing data in column-major format order.static BinaryTablefromRowMajor(Object[][] table) Creates a binary table from existing table data in row-major format.get(int row, int col) Returns a table element using the usual Java boxing for primitive scalar (singleton) entries, or packaging complex values asComplexValue, or as appropriate primitive or object arrays.getArrayElement(int row, int col) Returns a table element as an array of the FITS storage type.getArrayElementAs(int row, int col, Class<?> asType) Returns a numerical table element as an array of a specific underlying other numerical type.Class<?>[]getBases()Deprecated.(for internal use) Ambiguous, useBinaryTable.ColumnDesc.getElementClass()instead.getColumn(int col) Returns the data for a particular column in as an array of elements.ColumnTable<?> getData()Returns the underlying Java representation of the data contained in this HDU's data segment.getDescriptor(int column) Returns the column descriptor of a given column in this tablegetDescriptor(String name) Returns the (first) column descriptor whose name matches the specified value.static BinaryTable.ColumnDescgetDescriptor(Header header, int col) Extracts a column descriptor from the FITS header for a given column indexint[][]Deprecated.(for internal use) UseBinaryTable.ColumnDesc.getEntryShape()to access the shape of Java elements individually for columns instead.final doublegetDouble(int row, int col) Returns the decimal value, if possible, of a scalar table entry.getElement(int row, int col) Returns a table element as a Java array.Object[]Deprecated.(for internal use) It may be private in the future.getFlattenedColumn(int col) Deprecated.(for internal use) It may be reduced to private visibility in the future.final BooleangetLogical(int row, int col) Returns the boolean value, if possible, for scalar elements.final longgetLong(int row, int col) Returns a 64-bit integer value, if possible, of a scalar table entry.Object[]Deprecated.(for internal use) UseBinaryTable.getElement(int, int)instead for low-level reading of tables in deferred mode.intgetNCols()Returns the number of columns contained in this table.intgetNRows()Returns the number of columns contained in this table.final NumbergetNumber(int row, int col) Returns the numerical value, if possible, for scalar elements.getRawElement(int row, int col) Deprecated.(for internal use) Will reduce visibility in the future.Object[]getRow(int row) Returns an array of elements in a particualr table row.int[]getSizes()Deprecated.(for internal use) UseBinaryTable.ColumnDesc.getElementCount()instead.final StringgetString(int row, int col) Returns the string value, if possible, for scalar elements.char[]getTypes()Deprecated.(for internal use) UseBinaryTable.ColumnDesc.getElementClass()instead.intReturns the Java index of the first column by the specified name.static int[]parseTDims(String tdims) Deprecated.(for internal use) It may be reduced to private visibility in the future.voidread(ArrayDataInput in) Reads the data or skips over it for reading later, depending on whether reading from a stream or a random acessible input, respectively.voidreserveHeapSpace(int bytes) Reserves space in the file at the end of the heap for future heap growth (e.g. different/longer or new VLA entries).voidreserveRowSpace(int rows) Reserves space for future addition of rows at the end of the regular table.voidThe Swiss-army knife of setting table entries, including Java boxing, and with some support for automatic type conversions.voidSets new data for a table column.booleansetComplexColumn(int index) Convert a column from float/double to float complex/double complex.voidsetElement(int row, int col, Object o) Consider using the more Java-friendlyBinaryTable.set(int, int, Object)with implicit scalar type conversions.voidsetFlattenedColumn(int col, Object data) Deprecated.(for internal use) It may be reduced to private visibility in the future.voidSets new data for a table row.toHDU()Returns an approprotae HDU object that encapsulates this FITS data, and contains the minimal mandatory header description for that data.voidupdateAfterDelete(int oldNcol, Header hdr) Deprecated.It is not entirely foolproof for keeping the header in sync -- it is better to (re)wrap tables in a new HDU after column deletions, and then edit the new header as necessary to incorporate custom entries.voidwrite(ArrayDataOutput os) Writes the contents of the element to a data sink, adding padding as necessary if the element (such as a header or data segment) is expected to complete the FITS block of 2880 bytes.Methods inherited from class Data
calcChecksum, detach, getFileOffset, getKernel, getSize, isDeferred, isEmpty, reset, rewrite, rewriteableModifier and TypeMethodDescriptionlongComputes and returns the FITS checksum for this data, for example to compare against the storedDATASUMin the FITS header (e.g. viaBasicHDU.getStoredDatasum()).voiddetach()Detaches this data object from the input (if any), such as a file or stream, but not before loading data from the previously assigned input into memory.longReturns the byte offset at which this element starts ina file.final ObjectSame asData.getData().longgetSize()Returns the size of this elements in the FITS representation.booleanChecks if the data should be assumed to be in deferred read mode.booleanisEmpty()Checks if the data content is currently empty, i.e. no actual data is currently stored in memory.booleanreset()Reset the input stream to point to the beginning of this elementvoidrewrite()Rewrite the contents of the element in place.booleanChecks if we can write this element back to its source.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TableData
addRowEntries, setRowEntriesModifier and TypeMethodDescriptiondefault intaddRowEntries(Object... entries) LikeTableData.addRow(Object[]), but with a vararg list of row entries.default voidsetRowEntries(int row, Object... entries) LikeTableData.setRow(int, Object[])but with vararg list of entries.
-
Constructor Details
-
CompressedTableData
public CompressedTableData()Creates a new empty compressed table data to be initialized at a later point -
CompressedTableData
Creates a new compressed table data based on the prescription of the supplied header.- Parameters:
header- The header that describes the compressed table- Throws:
FitsException- If the header is invalid or could not be accessed.
-
-
Method Details
-
compress
(for internal use) This should only be called byCompressedTableHDU, and should have reduced visibility accordingly.- Parameters:
header- the compressed header- Throws:
FitsException- if the table cannot be compressed.
-
defragment
Description copied from class:BinaryTableDefragments the heap area of this table, compacting the heap area, and returning the number of bytes by which the heap size has been reduced. When tables with variable-sized columns are modified, the heap may retain old data as columns are removed or elements get replaced with new data of different size. The data order in the heap may also get jumbled, causing what would appear to be sequential reads to jump all over the heap space with the caching. And, depending on how the heap was constructed in the first place, it may not be optimal for the row-after-row table access that is the most typical use case.
This method rebuilds the heap by taking elements in table read order (by rows, and columns) and puts them on a new heap.
For best squential read performance, you should defragment all tables that have been built column-by-column before writing them to a FITS file. The only time defragmentation is really not needed is if the table was built row-by-row, with no modifications to variable-length content after the fact.
- Overrides:
defragmentin classBinaryTable- Returns:
- the number of bytes by which the heap has shrunk as a result of defragmentation.
- Throws:
FitsException- if there was an error accessing the heap or the main data table comntaining the heap locators. In case of an error the table content may be left in a damaged state.- See Also:
-
fillHeader
- Overrides:
fillHeaderin classBinaryTable- Throws:
FitsException
-
prepareUncompressedData
Deprecated.(for internal use) This should only be called byCompressedTableHDU, and its visibility will be reduced accordingly in the future, not to mention that it should take a BinaryTable as its argument.- Parameters:
data- The original (uncompressed) table data.- Throws:
FitsException
-
CompressedTableHDU, and its visibility will be reduced accordingly in the future, not to mention that it should take a BinaryTable as its argument.