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
ConstructorsConstructorDescriptionInstantiates a new FITS binary data encoder for converting Java arrays into FITS data representations -
Method Summary
Modifier and TypeMethodDescriptionstatic byteReturns the FITS byte value representing a logical value.static longReturns the size of this object as the number of bytes in a FITS binary representation.voidwriteArray(Object o) Writes the contents of a Java array to the output translating the data to the required binary representation.Methods inherited from class OutputEncoder
getCountModifier and TypeMethodDescriptionlonggetCount()Returns the number of encoded bytes that were written to the output.
-
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 supportsnullvalues, 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 tonulland 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:OutputEncoderWrites 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:
writeArrayin classOutputEncoder- Parameters:
o- the Java array, including heterogeneous arrays of arrays. Ifnullnothing 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).
-