Package nom.tam.util
Class BufferDecoder
java.lang.Object
nom.tam.util.InputDecoder
nom.tam.util.FitsDecoder
nom.tam.util.BufferDecoder
Deprecated.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class nom.tam.util.InputDecoder
InputDecoder.InputBuffer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkBuffer
(int needBytes) Deprecated.No longer used internally, kept only for back-compatibility since it used to be a needed abstract method.protected int
eofCheck
(EOFException e, int start, int index, int elementSize) Deprecated.No longer used internally, kept only for back-compatibility since it used to be a needed abstract method.protected int
read
(byte[] buf, int offset, int length) Deprecated.Reads bytes into an array from the input.protected long
readLArray
(Object o) Deprecated.See the contract ofArrayDataInput.readLArray(Object)
.Methods inherited from class nom.tam.util.FitsDecoder
booleanFor, booleanObjectFor, read, read, read, read, read, read, read, read, readArray, readAsciiLine, readBoolean, readByte, readChar, readDouble, readFloat, readInt, readLong, readShort, readUnsignedByte, readUnsignedShort
Methods inherited from class nom.tam.util.InputDecoder
getInputBuffer, read, readArrayFully, readFully, readImage, setInput
-
Constructor Details
-
BufferDecoder
Deprecated.- Parameters:
p
- Unused, but the position and length fields are set/reset as to pretend that half of the buffer is perpetually available for reading. However, at no point will there be any data actually in the buffer of this object, and you should by all means avoid directly loading data from the stream into this dead-end buffer, other than the hopefully untiggered existing implementation ofcheckBuffer(int)
(and it's safest if you don't override or ever callcheckBuffer(int)
from your code!).
-
-
Method Details
-
checkBuffer
Deprecated.No longer used internally, kept only for back-compatibility since it used to be a needed abstract method. It's safest if you never override or call this method from your code!- Parameters:
needBytes
- the number of byte we need available to decode the next element- Throws:
IOException
- if the data could not be made available due to an IO error of the underlying input.
-
read
Deprecated.Description copied from class:InputDecoder
Reads bytes into an array from the input. See the contract ofInputStream.read(byte[], int, int)
.- Overrides:
read
in classInputDecoder
- Parameters:
buf
- the destination arrayoffset
- the first index in the array to be populatedlength
- the number of bytes to read into the array.- Returns:
- the number of bytes successfully read, or -1 if at the end of the file.
- Throws:
IOException
- if an IO error, other than the end-of-file prevented the read.
-
eofCheck
@Deprecated protected int eofCheck(EOFException e, int start, int index, int elementSize) throws EOFException Deprecated.No longer used internally, kept only for back-compatibility since it used to be a needed abstract method.- Parameters:
e
- theEOFException
thrown by one of the read calls.start
- the index of the first array element we wanted to fillindex
- the array index of the element during which the exception was thrownelementSize
- the number of bytes per element we were processing- Returns:
- the numer of bytes successfully processed from the input before the exception occurred.
- Throws:
EOFException
- if the input had no more data to process
-
readLArray
Deprecated.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
-
FitsDecoder
instead which provides a similar function but in a more consistent way and with a less misleading name. This is a rusty rail implementation for of an older abandoned class only, unsafe for general use. For reading non-FITS encoding you may also useInputDecoder
as a base for implementing efficient custom decoding of binary inputs in general.