Package nom.tam.util
Class FitsEncoder
java.lang.Object
nom.tam.util.OutputEncoder
nom.tam.util.FitsEncoder
- Direct Known Subclasses:
BufferEncoder
Encodes select Java arrays into FITS binary format (primarily for internal use)
- Since:
- 1.16
- See Also:
-
Constructor Summary
ConstructorDescriptionInstantiates a new FITS binary data encoder for converting Java arrays into FITS data representations -
Method Summary
Modifier and TypeMethodDescriptionstatic byte
Returns the FITS byte value representing a logical value.static long
Returns the size of this object as the number of bytes in a FITS binary representation.void
writeArray
(Object o) Writes the contents of a Java array to the output translating the data to the required binary representation.Methods inherited from class nom.tam.util.OutputEncoder
getCount
-
Constructor Details
-
FitsEncoder
Instantiates a new FITS binary data encoder for converting Java arrays into FITS data representations- Parameters:
o
- the FITS output.
-
-
Method Details
-
byteForBoolean
Returns the FITS byte value representing a logical value. This call supportsnull
values, which are allowed by the FITS standard. FITS defines 'T' as true, 'F' as false, and 0 as null. Prior versions of this library have used the value 1 for true, and 0 for false. Therefore, this implementation will recognise both 'T' and 1 astrue
, but 0 will map tonull
and everything else will returnfalse
.- Parameters:
b
- A java boolean value ornull
- Returns:
- the FITS byte representation of a boolean value.
-
writeArray
Description copied from class:OutputEncoder
Writes the contents of a Java array to the output translating the data to the required binary representation. The argument may be any generic Java array, including heterogeneous arrays of arrays.- Specified by:
writeArray
in classOutputEncoder
- Parameters:
o
- the Java array, including heterogeneous arrays of arrays. Ifnull
nothing will be written to the output.- Throws:
IOException
- if there was an IO error writing to the outputIllegalArgumentException
- if the supplied object is not a Java array or if it contains Java types that are not supported by the decoder.- See Also:
-
computeSize
Returns the size of this object as the number of bytes in a FITS binary representation.- Parameters:
o
- the object- Returns:
- the number of bytes in the FITS binary representation of the object or 0 if the object has no FITS representation. (Also elements not known to FITS will count as 0 sized).
-