Package nom.tam.fits
Class FitsHeap
java.lang.Object
nom.tam.fits.FitsHeap
- All Implemented Interfaces:
 FitsElement
Heap for storing variable-length entries in binary tables. FITS binary tables store variable length arrays on a heap,
 following the regular array data. The newer implementation of the heap now provides proper random access to the byte
 buffer as of version 1.16.
- 
Method Summary
Modifier and TypeMethodDescriptionvoidGets data for a Java array from the heap.longReturns the byte offset at which this element starts ina file.longgetSize()Returns the size of this elements in the FITS representation.voidread(ArrayDataInput str) Read a FITS element from the input, starting at the current position.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.intsize()Returns the current heap size.voidwrite(ArrayDataOutput str) 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. 
- 
Method Details
- 
getData
Gets data for a Java array from the heap. The array may be a multi-dimensional array of arrays.- Parameters:
 offset- the heap byte offset at which the data begins.array- The array of primitives to be extracted.- Throws:
 FitsException- if the operation failed
 - 
getFileOffset
public long getFileOffset()Description copied from interface:FitsElementReturns the byte offset at which this element starts ina file. If the element was not obtained from an input, then 0 is returned.- Specified by:
 getFileOffsetin interfaceFitsElement- Returns:
 - the byte at which this element begins. This is only available if the data is originally read from a random access medium. Otherwise 0 is returned.
 
 - 
getSize
public long getSize()Description copied from interface:FitsElementReturns the size of this elements in the FITS representation. This may include padding if the element (such as a header or data segment) is expected to complete a FITS block of 2880 bytes.- Specified by:
 getSizein interfaceFitsElement- Returns:
 - The size of this element in bytes, or 0 if the element is empty or invalid.
 
 - 
read
Description copied from interface:FitsElementRead a FITS element from the input, starting at the current position. Ater the read, the implementations should leave the input position aligned to the start of the next FITS block.- Specified by:
 readin interfaceFitsElement- Parameters:
 str- The input data stream- Throws:
 FitsException- if the read was unsuccessful.
 - 
reset
public boolean reset()Description copied from interface:FitsElementReset the input stream to point to the beginning of this element- Specified by:
 resetin interfaceFitsElement- Returns:
 - True if the reset succeeded.
 
 - 
rewrite
Description copied from interface:FitsElementRewrite the contents of the element in place. The data must have been originally read from a random access device, and the size of the element may not have changed.- Specified by:
 rewritein interfaceFitsElement- Throws:
 IOException- if the rewrite was unsuccessful.FitsException- if the rewrite was unsuccessful.
 - 
rewriteable
public boolean rewriteable()Description copied from interface:FitsElementChecks if we can write this element back to its source. An element can only be written back if it is associated to a random accessible input and the current size FITS within the old block size.- Specified by:
 rewriteablein interfaceFitsElement- Returns:
 trueif this element can be rewritten?
 - 
size
public int size()Returns the current heap size.- Returns:
 - the size of the heap in bytes
 
 - 
write
Description copied from interface:FitsElementWrites 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.- Specified by:
 writein interfaceFitsElement- Parameters:
 str- The data sink.- Throws:
 FitsException- if the write was unsuccessful.
 
 -