public class JAInputStream
extends java.lang.Object
Constructor and Description |
---|
JAInputStream(java.io.InputStream instrm)
Constructs the input-stream, based on the given input-stream,
which is assumed to be unbuffered.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this stream.
|
int |
read()
Does a plain single-byte read on the underlying stream.
|
boolean |
readBoolean()
Reads a boolean value, represented as a byte value in {0,1}.
|
void |
readBuf(byte[] bb,
int pos,
int n)
Reads a byte-sequence from this stream, in to the given buffer,
at the given positon, and of the given length.
|
java.nio.ByteBuffer |
readByteBuffer(int N)
Creates and returns a (direct) byte buffer of the given size
from this stream, throwing an IO-exception if the actual size
does not match that specified.
|
byte[] |
readBytes(boolean compressed)
Reads and returns an array of bytes from this stream, performing
GZIP inflation if necessary.
|
float |
readFloat()
Reads a (4-byte) float from this stream.
|
java.awt.image.BufferedImage |
readImage()
Reads a buffered-image directly from this stream.
|
java.awt.image.BufferedImage |
readImage(boolean compressed)
Reads a possibly-compressed data block from this stream,
converts it to a buffered-image, and returns this image.
|
int |
readInt()
Reads a (4-byte, little-endian) integer from this stream.
|
java.lang.String |
readString()
Reads a length-prefixed string of ASCII (really, ISO-8859)
characters from this stream.
|
short |
readUnsignedShort()
Reads a (2-byte) unsigned short integer from this stream,
returning it as a short (so a large unsigned-short will be
returned as a negative short, in accordance with the usual
2's complement conventions).
|
void |
switchToUnGZIP()
Wrap this Java ARP stream's underlying input stream with
a
GZIPInputStream , so that GZIP inflation is performed
on all subsequent input. |
public JAInputStream(java.io.InputStream instrm) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException
public int read() throws java.io.IOException
java.io.IOException
public boolean readBoolean() throws java.io.IOException
java.io.IOException
public int readInt() throws java.io.IOException
java.io.IOException
public short readUnsignedShort() throws java.io.IOException
java.io.IOException
public float readFloat() throws java.io.IOException
java.io.IOException
public java.lang.String readString() throws java.io.IOException
java.io.IOException
public java.awt.image.BufferedImage readImage() throws java.io.IOException
java.io.IOException
public java.awt.image.BufferedImage readImage(boolean compressed) throws java.io.IOException
java.io.IOException
public void readBuf(byte[] bb, int pos, int n) throws java.io.IOException
java.io.IOException
public byte[] readBytes(boolean compressed) throws java.io.IOException
compressed
flag is set, this block is assumed
to require GZIP inflation in order to obtain the actual result;
in this case the inflated data is itself assumed to consist
of an integer byte-count followed by a data block of that size,
this block being the final result.java.io.IOException
public java.nio.ByteBuffer readByteBuffer(int N) throws java.io.IOException
java.io.IOException
public void switchToUnGZIP() throws java.io.IOException
GZIPInputStream
, so that GZIP inflation is performed
on all subsequent input.java.io.IOException