Package nom.tam.util
Class OutputEncoder
java.lang.Object
nom.tam.util.OutputEncoder
- Direct Known Subclasses:
FitsEncoder
Efficient base class for encoding Java arrays into binary output (primarily for internal use)
- Since:
- 1.16
- Author:
- Attila Kovacs
- See Also:
-
Constructor Summary
ConstructorDescriptionInstantiates a new Java-to-binary encoder for arrays, writing encoded data to the specified output. -
Method Summary
Modifier and TypeMethodDescriptionlong
getCount()
Returns the number of encoded bytes that were written to the output.abstract void
writeArray
(Object o) Writes the contents of a Java array to the output translating the data to the required binary representation.
-
Constructor Details
-
OutputEncoder
Instantiates a new Java-to-binary encoder for arrays, writing encoded data to the specified output.- Parameters:
o
- the output to which encoded data is to be written.
-
-
Method Details
-
getCount
public long getCount()Returns the number of encoded bytes that were written to the output. It does not include bytes written directly (unencoded) to the output, such as viawrite(int)
orwrite(byte[], int, int)
.- Returns:
- the number of encoded bytes written to the output.
- See Also:
-
writeArray
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.- 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:
-