Package nom.tam.fits
Class UndefinedData
java.lang.Object
nom.tam.fits.Data
nom.tam.fits.UndefinedData
- All Implemented Interfaces:
FitsElement
A container for unknown binary data types. We can still retrieve the data as a
byte[]
array, we just
don't know how to interpret it ourselves. This class makes sure we don't break when we encouter HDUs that we don't
(yet) support, such as HDU types defined by future FITS standards.- See Also:
-
Field Summary
Fields inherited from class nom.tam.fits.Data
dataSize, fileOffset, input
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.(for internal use).Deprecated.(for internal use). -
Method Summary
Modifier and TypeMethodDescriptionprotected void
fillHeader
(Header head) Describe the structure of this data object in the supplied header.final Bitpix
Returns the FITS element type as a Bitpux value.protected byte[]
Returns the data content that is currently in memory.byte[]
getData()
Returns the underlying Java representation of the data contained in this HDU's data segment.final int[]
Returns the dimensionality of the data (if any), in Java array index order.final int
Returns the number of repeated (data + parameter) groups in this data objectfinal int
Returns the size of the optional parameter space as stored by the PCOUNT keyword in the FITS header.protected long
Returns the calculated byte size of the data, regardless of whether the data is currently in memory or not.final String
Returns the FITS extension type as stored by the XTENSION keyword in the FITS header.protected void
Load data from the current position of the input into memory.toHDU()
Returns an approprotae HDU object that encapsulates this FITS data, and contains the minimal mandatory header description for that data.void
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.Methods inherited from class nom.tam.fits.Data
calcChecksum, detach, ensureData, getFileOffset, getKernel, getRandomAccessInput, getSize, isDeferred, isEmpty, read, reset, rewrite, rewriteable, setFileOffset
-
Constructor Details
-
UndefinedData
Deprecated.(for internal use). Visibility will be reduced to the package level in the future.Creates a new empty container for data of unknown type based on the provided FITS header information.- Parameters:
h
- The FITS header corresponding to the data segment in the HDU- Throws:
FitsException
- if there wan an error accessing or interpreting the provided header information.
-
UndefinedData
Deprecated.(for internal use). Users should always construct known data types. Reduce visibility to the package level.- Parameters:
x
- object to create the hdu from- Throws:
IllegalArgumentException
- If the object is not an array or contains elements that do not have a known binary size.
-
-
Method Details
-
fillHeader
Description copied from class:Data
Describe the structure of this data object in the supplied header.- Specified by:
fillHeader
in classData
- Parameters:
head
- header to fill with the data from the current data object
-
getCurrentData
protected byte[] getCurrentData()Description copied from class:Data
Returns the data content that is currently in memory. In case of a data object in deferred read state (that is its prescription has been parsed from the header, but no data content was loaded yet from a random accessible input), this call may returnnull
or an object representing empty data.- Specified by:
getCurrentData
in classData
- Returns:
- The current data content in memory.
- See Also:
-
getTrueSize
protected long getTrueSize()Description copied from class:Data
Returns the calculated byte size of the data, regardless of whether the data is currently in memory or not.- Specified by:
getTrueSize
in classData
- Returns:
- the calculated byte size for the data.
-
getXtension
Returns the FITS extension type as stored by the XTENSION keyword in the FITS header.- Returns:
- The value used for the XTENSION keyword in the FITS header
- Since:
- 1.19
-
getBitpix
Returns the FITS element type as a Bitpux value.- Returns:
- The FITS Bitpix value for the type of primitive data element used by this data
- Since:
- 1.19
-
getParameterCount
public final int getParameterCount()Returns the size of the optional parameter space as stored by the PCOUNT keyword in the FITS header.- Returns:
- The element count of the optional parameter space accompanying the main data, as stored by the PCOUNT header value.
- Since:
- 1.19
-
getGroupCount
public final int getGroupCount()Returns the number of repeated (data + parameter) groups in this data object- Returns:
- The number of repeated data + parameter blocks, as stored by the GCOUNT header value.
- Since:
- 1.19
-
getDimensions
public final int[] getDimensions()Returns the dimensionality of the data (if any), in Java array index order. That is, The value for NAXIS1 is the last value in the returned array- Returns:
- the regular dimensions of the data in Java index order (that is NAXIS1 is the last entry in the array),
or possibly
null
if no dimensions have been defined.
-
getData
Description copied from class:Data
Returns the underlying Java representation of the data contained in this HDU's data segment. Typically it will return a Java array of some kind.- Overrides:
getData
in classData
- Returns:
- the underlying Java representation of the data core object, such as a multi-dimensional Java array.
- Throws:
FitsException
- if the data could not be gathered.- See Also:
-
loadData
Description copied from class:Data
Load data from the current position of the input into memory. This may be triggered immediately when calling
Data.read(ArrayDataInput)
if called on a non random accessible input, or else later when data is accessed viaData.ensureData()
, for example as a result of aData.getData()
call. This method will not be called unless there is actual data of non-zero size to be read.Implementations should create appropriate data structures and populate them from the specified input.
- Specified by:
loadData
in classData
- Parameters:
in
- The input from which to load data- Throws:
IOException
- if the data could not be loaded from the input.- See Also:
-
write
Description copied from interface:FitsElement
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.- Specified by:
write
in interfaceFitsElement
- Specified by:
write
in classData
- Parameters:
o
- The data sink.- Throws:
FitsException
- if the write was unsuccessful.
-
toHDU
Description copied from class:Data
Returns an approprotae HDU object that encapsulates this FITS data, and contains the minimal mandatory header description for that data.
-