Package nom.tam.util
Class BufferEncoder
java.lang.Object
nom.tam.util.OutputEncoder
nom.tam.util.FitsEncoder
nom.tam.util.BufferEncoder
Deprecated.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class nom.tam.util.OutputEncoder
OutputEncoder.OutputBuffer
-
Field Summary
Fields inherited from class nom.tam.util.OutputEncoder
out
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
needBuffer
(int need) Deprecated.No longer used internally, kept only for back-compatibility since it used to be a needed abstract method.protected void
write
(byte[] b, int from, int len) Deprecated.Writes up to the specified number of bytes from a buffer directly to the output.protected void
writeUncheckedByte
(byte b) Deprecated.Writes a single byte to the output, but not before flushing the contents of the conversion buffer.Methods inherited from class nom.tam.util.FitsEncoder
byteForBoolean, computeSize, putArray, write, write, write, write, write, write, write, write, write, writeArray, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort
Methods inherited from class nom.tam.util.OutputEncoder
flush, getCount, getOutputBuffer, setOutput, write
-
Constructor Details
-
BufferEncoder
Deprecated.- Parameters:
p
- Unused, but the position and length fields are set/reset as to pretend that the buffer is perpetually half filled with data, and with position at 0. However, at no point will there be any data actually in the buffer of this object. You should by all means avoid directly writing data from this buffer to the output stream, other than the hopefully untriggered write of an existingneedBuffer(int)
implementation (and it's safest if you don't override or ever callneedBuffer(int)
from your code!).
-
-
Method Details
-
needBuffer
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:
need
- the number of consecutive bytes we need available in the conversion buffer- Throws:
IOException
- if the buffer could not be flushed to the output to free up space in the buffer.
-
write
Deprecated.Description copied from class:OutputEncoder
Writes up to the specified number of bytes from a buffer directly to the output. See the general contract ofDataOutputStream.write(byte[], int, int)
. The number of unencoded bytes written by this method are not reflected in the value returned byOutputEncoder.getCount()
.- Overrides:
write
in classOutputEncoder
- Parameters:
b
- the bufferfrom
- the starting buffer indexlen
- the number of bytes to write.- Throws:
IOException
- if there was an underlying IO error- See Also:
-
writeUncheckedByte
Deprecated.Writes a single byte to the output, but not before flushing the contents of the conversion buffer. The suppliedBufferPointer
is not used at all, and is immediately invalidated (which is consistent with having flushed all pending output). It's not all that efficient, but then again one should be using the newFitsEncoder
instead. This is really just a rusty rail solution. Also, since this methods does not throw an exception, andneedBuffer(int)
(which did throw an exception) is no longer in use, the duct-tape solution is to convert any IOException encountered here into a runtime exception...- Parameters:
b
- the byte to write- Throws:
IllegalStateException
- if there was an IO error flushing the conversion buffer or writing the new byte after it.
-
FitsEncoder
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 writing non-FITS encoding you may also useOutputEncoder
as a base for implementing efficient custom encoding of binary outputs in general.