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 readprotected RandomAccess
The input stream used. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Object
getData()
long
long
getSize()
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
-
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
-
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.
-
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.
-