Package nom.tam.util
Class InputDecoder
java.lang.Object
nom.tam.util.InputDecoder
- Direct Known Subclasses:
FitsDecoder
Efficient base class for decoding of binary input into Java arrays (primarily for internal use)
- Since:
- 1.16
- Author:
- Attila Kovacs
- See Also:
-
Constructor Summary
ConstructorDescriptionInstantiates a new decoder for converting data representations into Java arrays. -
Method Summary
Modifier and TypeMethodDescriptionabstract long
See the contract ofArrayDataInput.readLArray(Object)
.void
Based onreadArray(Object)
, but guaranteeing a complete read of the supplied object or else anEOFException
is thrown.void
LikereadArrayFully(Object)
but strictly for numerical types only.
-
Constructor Details
-
InputDecoder
Instantiates a new decoder for converting data representations into Java arrays.- Parameters:
i
- the binary input.
-
-
Method Details
-
readArrayFully
Based onreadArray(Object)
, but guaranteeing a complete read of the supplied object or else anEOFException
is thrown.- Parameters:
o
- the array, including multi-dimensional, and heterogeneous arrays of arrays.- Throws:
EOFException
- if already at the end of file.IOException
- if there was an IO errorIllegalArgumentException
- if the argument is not a Java array, or is or contains elements that do not have supported conversions from binary representation.- See Also:
-
readArray
See the contract ofArrayDataInput.readLArray(Object)
.- 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:
IllegalArgumentException
- if the argument is not an array or if it contains an element that is not supported for decoding.IOException
- if there was an IO error reading from the input- See Also:
-
readImage
LikereadArrayFully(Object)
but strictly for numerical types only.- Parameters:
o
- An any-dimensional array containing only numerical types- Throws:
IllegalArgumentException
- if the argument is not an array or if it contains an element that is not supported.EOFException
- if already at the end of file.IOException
- if there was an IO error- Since:
- 1.18
- See Also:
-