Package nom.tam.fits
Class Data
java.lang.Object
nom.tam.fits.Data
- All Implemented Interfaces:
FitsElement
- Direct Known Subclasses:
AbstractTableData
,ImageData
,RandomGroupsData
,UndefinedData
This class provides methods to access the data segment of an HDU.
This is the object which contains the actual data for the HDU.
- For images and primary data this is a simple (but possibly multi-dimensional) primitive array. When group data is supported it will be a possibly multidimensional array of group objects.
- For ASCII data it is a two dimensional Object array where each of the constituent objects is a primitive array of length 1.
- For Binary data it is a two dimensional Object array where each of the constituent objects is a primitive array of arbitrary (more or less) dimensionality.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected long
The size of the data when last readprotected long
The starting location of the data when last readprivate static final int
protected RandomAccess
The input stream used.private static final Logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) abstract void
fillHeader
(Header head) Modify a header to point to this data, this differs per subclass, they all need oder provided different informations to the header.abstract Object
getData()
long
long
getSize()
(package private) abstract long
abstract void
read
(ArrayDataInput in) Read a data array into the current object and if needed position to the beginning of the next FITS block.boolean
reset()
Reset the input stream to point to the beginning of this elementvoid
rewrite()
Rewrite the contents of the element in place.boolean
protected void
Set the fields needed for a re-read.abstract void
Write the data -- including any buffering needed
-
Field Details
-
LOG
-
FITS_BLOCK_SIZE_MINUS_ONE
private static final int FITS_BLOCK_SIZE_MINUS_ONE- See Also:
-
fileOffset
protected long fileOffsetThe starting location of the data when last read -
dataSize
protected long dataSizeThe size of the data when last read -
input
The input stream used.
-
-
Constructor Details
-
Data
public Data()
-
-
Method Details
-
fillHeader
Modify a header to point to this data, this differs per subclass, they all need oder provided different informations to the header. Basically they describe the structure of this data object.- Parameters:
head
- header to fill with the data from the current data object- Throws:
FitsException
- if the operation fails
-
getData
- Returns:
- the data array object.
- Throws:
FitsException
- if the data could not be gathered .
-
getFileOffset
public long getFileOffset()- Specified by:
getFileOffset
in interfaceFitsElement
- Returns:
- the file offset
-
getKernel
- Returns:
- the non-FITS data object.
- Throws:
FitsException
- if the data could not be gathered .
-
getSize
public long getSize()- Specified by:
getSize
in interfaceFitsElement
- Returns:
- the size of the data element in bytes.
-
getTrueSize
abstract long getTrueSize() -
read
Description copied from interface:FitsElement
Read a data array into the current object and if needed position to the beginning of the next FITS block.- Specified by:
read
in interfaceFitsElement
- Parameters:
in
- The input data stream- Throws:
FitsException
- if the read was unsuccessful.
-
reset
public boolean reset()Description copied from interface:FitsElement
Reset the input stream to point to the beginning of this element- Specified by:
reset
in interfaceFitsElement
- Returns:
- True if the reset succeeded.
-
rewrite
Description copied from interface:FitsElement
Rewrite 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:
rewrite
in interfaceFitsElement
- Throws:
FitsException
- if the rewrite was unsuccessful.
-
rewriteable
public boolean rewriteable()- Specified by:
rewriteable
in interfaceFitsElement
- Returns:
true
if this element can be rewritten?
-
setFileOffset
Set the fields needed for a re-read.- Parameters:
o
- reread information.
-
write
Write the data -- including any buffering needed- Specified by:
write
in interfaceFitsElement
- Parameters:
o
- The output stream on which to write the data.- Throws:
FitsException
- if the write was unsuccessful.
-