Package nom.tam.util
Class FitsDecoder
java.lang.Object
nom.tam.util.InputDecoder
nom.tam.util.FitsDecoder
- Direct Known Subclasses:
BufferDecoder
Decodes FITS-formatted binary data into Java arrays (primarily for internal use)
- Since:
- 1.16
- See Also:
-
Constructor Summary
ConstructorDescriptionInstantiates a new FITS binary data decoder for converting FITS data representations into Java arrays. -
Method Summary
Modifier and TypeMethodDescriptionstatic final boolean
booleanFor
(int c) Gets theboolean
equivalent for a FITS byte value representing a logical value.static final Boolean
booleanObjectFor
(int c) Gets theboolean
equivalent for a FITS byte value representing a logical value.long
See the contract ofArrayDataInput.readLArray(Object)
.Methods inherited from class nom.tam.util.InputDecoder
readArrayFully, readImage
-
Constructor Details
-
FitsDecoder
Instantiates a new FITS binary data decoder for converting FITS data representations into Java arrays.- Parameters:
i
- the FITS input.
-
-
Method Details
-
booleanFor
public static final boolean booleanFor(int c) Gets theboolean
equivalent for a FITS byte value representing a logical value. This call does not supportnull
values, which are allowed by the FITS standard, but the similarbooleanObjectFor(int)
does. FITS defines 'T' as true, 'F' as false, and 0 as null. However, 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
, and will returnfalse
for all other byte values.- Parameters:
c
- The FITS byte that defines a boolean value- Returns:
true
if and only if the byte is the ASCII character 'T' or has the value of 1, otherwisefalse
.- See Also:
-
booleanObjectFor
Gets theboolean
equivalent for a 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:
c
- The FITS byte that defines a boolean value- Returns:
true
if and only if the byte is the ASCII character 'T' or has the value of 1,null
it the byte is 0, otherwisefalse
.- See Also:
-
readArray
Description copied from class:InputDecoder
See the contract ofArrayDataInput.readLArray(Object)
.- Specified by:
readArray
in classInputDecoder
- Parameters:
o
- an array, to be populated- Returns:
- the actual number of bytes read from the input, or -1 if already at the end-of-file.
- Throws:
IOException
- if there was an IO error reading from the inputIllegalArgumentException
- if the argument is not an array or if it contains an element that is not supported for decoding.- See Also:
-