Class RandomGroupsData

java.lang.Object
nom.tam.fits.Data
nom.tam.fits.RandomGroupsData
All Implemented Interfaces:
FitsElement

public class RandomGroupsData extends Data
Random Groups data. The use of random groups is discouraged, even by the FITS standard. Some old radio data may be packaged in this format. Thus apart from provided limited support for reading such data, users should not create random groups anew. 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:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create the equivalent of a null data element.
    Create a RandomGroupsData object using the specified object to initialize the data array.
  • Method Summary

    Modifier and Type
    Method
    Description
    Object[][]
    Returns the underlying Java representation of the data contained in this HDU's data segment.
    int[]
    Returns the dimensions of the grouped data
    Returns the Java class of the the parameter and data array elements.
    getImage(int group)
    Returns the image component stored in the specified group.
    int
    Returns the dimensions of the grouped parameters
    boolean
    Checks if the data content is currently empty, i.e. no actual data is currently stored in memory.
    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 Data

    calcChecksum, detach, getFileOffset, getKernel, getSize, isDeferred, read, reset, rewrite, rewriteable
    Modifier and Type
    Method
    Description
    long
    Computes and returns the FITS checksum for this data, for example to compare against the stored DATASUM in the FITS header (e.g. via BasicHDU.getStoredDatasum()).
    void
    Detaches this data object from the input (if any), such as a file or stream, but not before loading data from the previously assigned input into memory.
    long
    Returns the byte offset at which this element starts ina file.
    final Object
    long
    Returns the size of this elements in the FITS representation.
    boolean
    Checks if the data should be assumed to be in deferred read mode.
    void
    Reads the data or skips over it for reading later, depending on whether reading from a stream or a random acessible input, respectively.
    boolean
    Reset the input stream to point to the beginning of this element
    void
    Rewrite the contents of the element in place.
    boolean
    Checks if we can write this element back to its source.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RandomGroupsData

      public RandomGroupsData()
      Create the equivalent of a null data element.
    • RandomGroupsData

      public RandomGroupsData(Object[][] x) throws IllegalArgumentException
      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

      public Class<?> 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 null if not defined.
      Since:
      1.18
      See Also:
    • isEmpty

      public boolean isEmpty()
      Description copied from class: Data
      Checks if the data content is currently empty, i.e. no actual data is currently stored in memory.
      Overrides:
      isEmpty in class Data
      Returns:
      true if there is no actual data in memory, otherwise false
      See Also:
    • getData

      public Object[][] getData() throws FitsException
      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 class Data
      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

      public void write(ArrayDataOutput str) throws FitsException
      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 interface FitsElement
      Specified by:
      write in class Data
      Parameters:
      str - The data sink.
      Throws:
      FitsException - if the write was unsuccessful.
    • toHDU

      public RandomGroupsHDU toHDU() throws FitsException
      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.
      Specified by:
      toHDU in class Data
      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

      public Object getImage(int group) throws ArrayIndexOutOfBoundsException, FitsException
      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 bounds
      FitsException - if the deferred data could not be loaded.
      Since:
      1.19
      See Also: