Package nom.tam.fits
Class Data
- java.lang.Object
-
- nom.tam.fits.Data
-
- All Implemented Interfaces:
FitsElement
- Direct Known Subclasses:
AbstractTableData
,ImageData
,RandomGroupsData
,UndefinedData
public abstract class Data extends java.lang.Object implements FitsElement
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
Fields Modifier and Type Field Description protected long
dataSize
The size of the data when last readprotected long
fileOffset
The starting location of the data when last readprivate static int
FITS_BLOCK_SIZE_MINUS_ONE
protected RandomAccess
input
The input stream used.private static java.util.logging.Logger
LOG
-
Constructor Summary
Constructors Constructor Description Data()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (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 java.lang.Object
getData()
long
getFileOffset()
java.lang.Object
getKernel()
long
getSize()
(package private) abstract long
getTrueSize()
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
rewriteable()
protected void
setFileOffset(ArrayDataInput o)
Set the fields needed for a re-read.abstract void
write(ArrayDataOutput o)
Write the data -- including any buffering needed
-
-
-
Field Detail
-
LOG
private static final java.util.logging.Logger LOG
-
FITS_BLOCK_SIZE_MINUS_ONE
private static final int FITS_BLOCK_SIZE_MINUS_ONE
- See Also:
- Constant Field Values
-
fileOffset
protected long fileOffset
The starting location of the data when last read
-
dataSize
protected long dataSize
The size of the data when last read
-
input
protected RandomAccess input
The input stream used.
-
-
Method Detail
-
fillHeader
abstract void fillHeader(Header head) throws FitsException
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
public abstract java.lang.Object getData() throws FitsException
- 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
public java.lang.Object getKernel() throws FitsException
- 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
public abstract void read(ArrayDataInput in) throws FitsException
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
public void rewrite() throws FitsException
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
protected void setFileOffset(ArrayDataInput o)
Set the fields needed for a re-read.- Parameters:
o
- reread information.
-
write
public abstract void write(ArrayDataOutput o) throws FitsException
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.
-
-