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 longdataSizeThe size of the data when last readprotected longfileOffsetThe starting location of the data when last readprivate static intFITS_BLOCK_SIZE_MINUS_ONEprotected RandomAccessinputThe input stream used.private static java.util.logging.LoggerLOG
-
Constructor Summary
Constructors Constructor Description Data()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract voidfillHeader(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.ObjectgetData()longgetFileOffset()java.lang.ObjectgetKernel()longgetSize()(package private) abstract longgetTrueSize()abstract voidread(ArrayDataInput in)Read a data array into the current object and if needed position to the beginning of the next FITS block.booleanreset()Reset the input stream to point to the beginning of this elementvoidrewrite()Rewrite the contents of the element in place.booleanrewriteable()protected voidsetFileOffset(ArrayDataInput o)Set the fields needed for a re-read.abstract voidwrite(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:
getFileOffsetin 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:
getSizein 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:FitsElementRead a data array into the current object and if needed position to the beginning of the next FITS block.- Specified by:
readin interfaceFitsElement- Parameters:
in- 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
public void rewrite() throws FitsExceptionDescription 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:
FitsException- if the rewrite was unsuccessful.
-
rewriteable
public boolean rewriteable()
- Specified by:
rewriteablein interfaceFitsElement- Returns:
trueif 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:
writein interfaceFitsElement- Parameters:
o- The output stream on which to write the data.- Throws:
FitsException- if the write was unsuccessful.
-
-