Class RandomGroupsData
- All Implemented Interfaces:
FitsElement
BinaryTable offers a much more flexible and capable way for storing an ensemble of
parameters, arrays, and more.
Random groups are instantiated as a two-dimensional array of objects. The first dimension of the array is the number of groups. The second dimension is 2. The first object in every row is a one dimensional parameter array. The second element is the n-dimensional data array.
- See Also:
-
Field Summary
Fields inherited from class nom.tam.fits.Data
dataSize, fileOffset, input -
Constructor Summary
ConstructorsConstructorDescriptionCreate the equivalent of a null data element.RandomGroupsData(Object[][] x) Create a RandomGroupsData object using the specified object to initialize the data array. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidfillHeader(Header h) Describe the structure of this data object in the supplied header.protected Object[][]Returns the data content that is currently in memory.Object[][]getData()Returns the underlying Java representation of the data contained in this HDU's data segment.int[]Returns the dimensions of the grouped dataClass<?> Returns the Java class of the the parameter and data array elements.getImage(int group) Returns the image component stored in the specified group.intReturns the dimensions of the grouped parametersprotected longReturns the calculated byte size of the data, regardless of whether the data is currently in memory or not.booleanisEmpty()Checks if the data content is currently empty, i.e.protected voidLoad 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.voidwrite(ArrayDataOutput str) 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, read, reset, rewrite, rewriteable, setFileOffset
-
Constructor Details
-
RandomGroupsData
public RandomGroupsData()Create the equivalent of a null data element. -
RandomGroupsData
Create a RandomGroupsData object using the specified object to initialize the data array.- Parameters:
x- The initial data array. This should a two-d array of objects as described above.- Throws:
IllegalArgumentException- if the second array dimension is specified and it is not 2, or if the parameter arrya is not 1-dimensional, or if the parameter and data types differ.
-
-
Method Details
-
getElementType
Returns the Java class of the the parameter and data array elements.- Returns:
- The java class of the parameter and data elements.
- Since:
- 1.18
-
getParameterCount
public int getParameterCount()Returns the dimensions of the grouped parameters- Returns:
- The dimensions of the parameters or -1 if not defined.
- Since:
- 1.18
- See Also:
-
getDataDims
public int[] getDataDims()Returns the dimensions of the grouped data- Returns:
- The dimensions of the parameters, or
nullif not defined. - Since:
- 1.18
- See Also:
-
fillHeader
Description copied from class:DataDescribe the structure of this data object in the supplied header.- Specified by:
fillHeaderin classData- Parameters:
h- header to fill with the data from the current data object- Throws:
FitsException- if the operation fails
-
getTrueSize
protected long getTrueSize()Description copied from class:DataReturns the calculated byte size of the data, regardless of whether the data is currently in memory or not.- Specified by:
getTrueSizein classData- Returns:
- the calculated byte size for the data.
-
isEmpty
public boolean isEmpty()Description copied from class:DataChecks if the data content is currently empty, i.e. no actual data is currently stored in memory. -
loadData
Description copied from class:DataLoad 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:
loadDatain classData- Parameters:
in- The input from which to load data- Throws:
IOException- if the data could not be loaded from the input.- See Also:
-
getCurrentData
Description copied from class:DataReturns 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 returnnullor an object representing empty data.- Specified by:
getCurrentDatain classData- Returns:
- The current data content in memory.
- See Also:
-
getData
Description copied from class:DataReturns 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:
getDatain 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:
-
write
Description copied from interface:FitsElementWrites 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:
writein interfaceFitsElement- Specified by:
writein classData- Parameters:
str- The data sink.- Throws:
FitsException- if the write was unsuccessful.
-
toHDU
Description copied from class:DataReturns an approprotae HDU object that encapsulates this FITS data, and contains the minimal mandatory header description for that data.- Specified by:
toHDUin classData- Returns:
- a HDU object ocntaining the data and its minimal required header description
- Throws:
FitsException- If the data cannot be converted to an HDU for some reason.
-
getImage
Returns the image component stored in the specified group.- Parameters:
group- The zero-based group index- Returns:
- The image array for the specified group
- Throws:
ArrayIndexOutOfBoundsException- if the group index is out of boundsFitsException- if the deferred data could not be loaded.- Since:
- 1.19
- See Also:
-