public interface ImageInputStream extends java.io.DataInput
ImageReaders.| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
void |
flushBefore(long pos) |
int |
getBitOffset() |
java.nio.ByteOrder |
getByteOrder() |
long |
getFlushedPosition() |
long |
getStreamPosition() |
boolean |
isCached() |
boolean |
isCachedFile() |
boolean |
isCachedMemory() |
long |
length() |
void |
mark() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int offset,
int length) |
int |
readBit() |
long |
readBits(int numBits) |
boolean |
readBoolean()
Reads a byte and checks whether or not its value is zero.
|
byte |
readByte()
Reads a signed byte.
|
void |
readBytes(IIOByteBuffer buf,
int numBytes)
Reads up to a specified number of bytes, and modifies a
IIOByteBuffer to hold the read data. |
char |
readChar()
Reads an unsigned 16-bit integer.
|
double |
readDouble()
Reads an IEEE 64-bit double-precision floating point number.
|
float |
readFloat()
Reads an IEEE 32-bit single-precision floating point number.
|
void |
readFully(byte[] b)
Reads a sequence of signed 8-bit integers into a
byte[] array. |
void |
readFully(byte[] b,
int offset,
int numBytes)
Reads a sequence of signed 8-bit integers into a
byte[] array. |
void |
readFully(char[] c,
int offset,
int numChars)
Reads a sequence of unsigned 16-bit integers into a
char[] array. |
void |
readFully(double[] d,
int offset,
int numDoubles)
Reads a sequence of IEEE 64-bit double-precision floating point
numbers into a
double[] array. |
void |
readFully(float[] f,
int offset,
int numFloats)
Reads a sequence of IEEE 32-bit single-precision floating point
numbers into a
float[] array. |
void |
readFully(int[] i,
int offset,
int numInts)
Reads a sequence of signed 32-bit integers into a
long[] array. |
void |
readFully(long[] l,
int offset,
int numLongs)
Reads a sequence of signed 64-bit integers into a
long[] array. |
void |
readFully(short[] s,
int offset,
int numShorts)
Reads a sequence of signed 16-bit integers into a
short[] array. |
int |
readInt()
Reads a signed 32-bit integer.
|
java.lang.String |
readLine()
This method reads the next line of text data from an input stream.
|
long |
readLong()
Reads a signed 64-bit integer.
|
short |
readShort()
Reads an signed 16-bit integer.
|
int |
readUnsignedByte()
Reads an unsigned byte.
|
long |
readUnsignedInt()
Reads an unsigned 32-bit integer.
|
int |
readUnsignedShort()
Reads an unsigned 16-bit integer.
|
java.lang.String |
readUTF()
This method reads a
String from an input stream that is
encoded in a modified UTF-8 format. |
void |
reset() |
void |
seek(long pos) |
void |
setBitOffset(int bitOffset) |
void |
setByteOrder(java.nio.ByteOrder order) |
int |
skipBytes(int numBytes)
This method skips and discards the specified number of bytes in an
input stream.
|
long |
skipBytes(long numBytes) |
void setByteOrder(java.nio.ByteOrder order)
java.nio.ByteOrder getByteOrder()
int read() throws java.io.IOException
java.io.IOExceptionint read(byte[] b) throws java.io.IOException
java.io.IOExceptionint read(byte[] b, int offset, int length) throws java.io.IOException
java.io.IOExceptionvoid readBytes(IIOByteBuffer buf, int numBytes) throws java.io.IOException
IIOByteBuffer to hold the read data.
The bit offset is set to zero before any data is read.
buf - an IIOByteBuffer that will hold the read
data.numBytes - the maximum number of bytes to read.java.lang.IndexOutOfBoundsException - if numBytes is
negative.java.lang.NullPointerException - if buf is
null.java.io.IOException - if some general problem happens with
accessing data.boolean readBoolean() throws java.io.IOException
The bit offset is set to zero before the byte is read.
readBoolean in interface java.io.DataInputboolean value readjava.io.EOFException - if the input stream is at its end.java.io.IOException - if some general problem happens with
accessing data.readBit(),
readByte(),
readFully(byte[], int, int)byte readByte() throws java.io.IOException
The bit offset is set to zero before any data is read.
readByte in interface java.io.DataInputbyte value readjava.io.EOFException - if the input stream is at its end.java.io.IOException - if some general problem happens with
accessing data.readUnsignedByte(),
readFully(byte[], int, int)int readUnsignedByte() throws java.io.IOException
The bit offset is set to zero before any data is read.
readUnsignedByte in interface java.io.DataInputint.java.io.EOFException - if the input stream is at its end.java.io.IOException - if some general problem happens with
accessing data.readByte(),
readFully(byte[], int, int)short readShort() throws java.io.IOException
The bit offset is set to zero before any data is read.
readShort in interface java.io.DataInputshort value readjava.io.EOFException - if the input stream ends before all two
bytes were read.java.io.IOException - if some general problem happens with
accessing data.readUnsignedShort(),
readChar(),
readFully(short[], int, int)int readUnsignedShort() throws java.io.IOException
The bit offset is set to zero before any data is read.
This method does the same as readChar().
readUnsignedShort in interface java.io.DataInputint.java.io.EOFException - if the input stream ends before all two
bytes were read.java.io.IOException - if some general problem happens with
accessing data.readShort(),
readChar(),
readFully(char[], int, int)char readChar() throws java.io.IOException
The bit offset is set to zero before any data is read.
This method does the same as readUnsignedShort().
readChar in interface java.io.DataInputchar value readjava.io.EOFException - if the input stream ends before all two
bytes were read.java.io.IOException - if some general problem happens with
accessing data.readFully(char[], int, int)int readInt() throws java.io.IOException
The bit offset is set to zero before any data is read.
readInt in interface java.io.DataInputint value readjava.io.EOFException - if the input stream ends before all four
bytes were read.java.io.IOException - if some general problem happens with
accessing data.readUnsignedInt(),
readFully(int[], int, int)long readUnsignedInt() throws java.io.IOException
The bit offset is set to zero before any data is read.
java.io.EOFException - if the input stream ends before all four
bytes were read.java.io.IOException - if some general problem happens with
accessing data.readInt(),
readFully(int[], int, int)long readLong() throws java.io.IOException
The bit offset is set to zero before any data is read.
readLong in interface java.io.DataInputlong value readjava.io.EOFException - if the input stream ends before all eight
bytes were read.java.io.IOException - if some general problem happens with
accessing data.readFully(long[], int, int)float readFloat() throws java.io.IOException
The bit offset is set to zero before any data is read.
readFloat in interface java.io.DataInputfloat value readjava.io.EOFException - if the input stream ends before all four
bytes were read.java.io.IOException - if some general problem happens with
accessing data.readFully(float[], int, int)double readDouble() throws java.io.IOException
The bit offset is set to zero before any data is read.
readDouble in interface java.io.DataInputdouble value readjava.io.EOFException - if the input stream ends before all eight
bytes were read.java.io.IOException - if some general problem happens with
accessing data.readFully(double[], int, int)java.lang.String readLine() throws java.io.IOException
java.io.DataInputchar
values by treating the byte read as the low eight bits of the
char and using 0 as the high eight bits. Because of this,
it does not support the full 16-bit Unicode character set.
The reading of bytes ends when either the end of file or a line terminator
is encountered. The bytes read are then returned as a
String.
A line terminator is a byte sequence consisting of either
\r, \n or \r\n. These termination
charaters are discarded and are not returned as part of the string.
A line is also terminated by an end of file condition.
readLine in interface java.io.DataInputStringjava.io.IOException - If an error occursjava.lang.String readUTF() throws java.io.IOException
java.io.DataInputString from an input stream that is
encoded in a modified UTF-8 format. This format has a leading two byte
sequence that contains the remaining number of bytes to read.
This two byte
sequence is read using the readUnsignedShort() method of this
interface.
After the number of remaining bytes have been determined, these bytes
are read an transformed into char values. These
char values are encoded in the stream using either a one,
two, or three byte format.
The particular format in use can be determined by examining the first
byte read.
If the first byte has a high order bit of 0, then
that character consists on only one byte. This character value consists
of seven bits that are at positions 0 through 6 of the byte. As an
example, if byte1 is the byte read from the stream, it would
be converted to a char like so:
(char)byte1
If the first byte has 110 as its high order bits, then the character consists of two bytes. The bits that make up the character value are in positions 0 through 4 of the first byte and bit positions 0 through 5 of the second byte. (The second byte should have 10 as its high order bits). These values are in most significant byte first (i.e., "big endian") order.
As an example, if byte1 and byte2 are the first
two bytes read respectively, and the high order bits of them match the
patterns which indicate a two byte character encoding, then they would be
converted to a Java char like so:
(char)(((byte1 & 0x1F) << 6) + (byte2 & 0x3F))
If the first byte has a 1110 as its high order bits, then the character consists of three bytes. The bits that make up the character value are in positions 0 through 3 of the first byte and bit positions 0 through 5 of the other two bytes. (The second and third bytes should have 10 as their high order bits). These values are in most significant byte first (i.e., "big endian") order.
As an example, if byte1, byte2, and
byte3 are the three bytes read, and the high order bits of
them match the patterns which indicate a three byte character encoding,
then they would be converted to a Java char like so:
(char)(((byte1 & 0x0F) << 12) + ((byte2 & 0x3F) + (byte3 & 0x3F))
Note that all characters are encoded in the method that requires the
fewest number of bytes with the exception of the character with the
value of \<llll>u0000 which is encoded as two bytes.
This is a modification of the UTF standard used to prevent C language
style NUL values from appearing in the byte stream.
This method can read data that was written by an object implementing the
writeUTF() method in DataOutput.
readUTF in interface java.io.DataInputString readjava.io.EOFException - If end of file is reached before reading the
Stringjava.io.UTFDataFormatException - If the data is not in UTF-8 formatjava.io.IOException - If any other error occursDataOutput.writeUTF(java.lang.String)void readFully(byte[] b, int offset, int numBytes) throws java.io.IOException
byte[] array.
The bit offset is set to zero before any data is read.
readFully in interface java.io.DataInputb - an array for storing the read values.offset - the index of the first element in b
that will hold read data.numBytes - the number of bytes to read.java.lang.IndexOutOfBoundsException - if offset or
numBytes is negative, or if offset +
numBytes exceeds b.length.java.lang.NullPointerException - if b is
null.java.io.EOFException - if the input stream ends before all content
was read.java.io.IOException - if some general problem happens with
accessing data.readByte()void readFully(byte[] b) throws java.io.IOException
byte[] array.
The bit offset is set to zero before any data is read.
readFully in interface java.io.DataInputb - an array for storing the read values.java.lang.NullPointerException - if b is
null.java.io.EOFException - if the input stream ends before all content
was read.java.io.IOException - if some general problem happens with
accessing data.readByte(),
readFully(byte[], int, int)void readFully(short[] s, int offset, int numShorts) throws java.io.IOException
short[] array. If necessary, values are converted
from the stream’s current byte
order.
The bit offset is set to zero before any data is read.
s - an array for storing the read values.offset - the index of the first element in s
that will hold read data.numShorts - the number of signed 16-bit integers to read
(which is one half of the number of bytes).java.lang.IndexOutOfBoundsException - if offset or
numShorts is negative, or if offset +
numShorts exceeds s.length.java.lang.NullPointerException - if s is
null.java.io.EOFException - if the input stream ends before all content
was read.java.io.IOException - if some general problem happens with
accessing data.readShort()void readFully(char[] c, int offset, int numChars) throws java.io.IOException
char[] array. If necessary, values are converted
from the stream’s current byte
order.
The bit offset is set to zero before any data is read.
c - an array for storing the read values.offset - the index of the first element in c
that will hold read data.numChars - the number of unsigned 16-bit integers to read
(which is one half of the number of bytes).java.lang.IndexOutOfBoundsException - if offset or
numChars is negative, or if offset +
numChars exceeds c.length.java.lang.NullPointerException - if c is
null.java.io.EOFException - if the input stream ends before all content
was read.java.io.IOException - if some general problem happens with
accessing data.readChar()void readFully(int[] i, int offset, int numInts) throws java.io.IOException
long[] array. If necessary, values are converted
from the stream’s current byte
order.
The bit offset is set to zero before any data is read.
i - an array for storing the read values.offset - the index of the first element in i
that will hold read data.numInts - the number of signed 32-bit integers to read
(which is one fourth of the number of bytes).java.lang.IndexOutOfBoundsException - if offset or
numInts is negative, or if offset +
numInts exceeds i.length.java.lang.NullPointerException - if i is
null.java.io.EOFException - if the input stream ends before all content
was read.java.io.IOException - if some general problem happens with
accessing data.readInt()void readFully(long[] l, int offset, int numLongs) throws java.io.IOException
long[] array. If necessary, values are converted
from the stream’s current byte
order.
The bit offset is set to zero before any data is read.
l - an array for storing the read values.offset - the index of the first element in l
that will hold read data.numLongs - the number of signed 64-bit integers to read
(which is one eight of the number of bytes).java.lang.IndexOutOfBoundsException - if offset or
numLongs is negative, or if offset +
numLongs exceeds l.length.java.lang.NullPointerException - if l is
null.java.io.EOFException - if the input stream ends before all content
was read.java.io.IOException - if some general problem happens with
accessing data.readLong()void readFully(float[] f, int offset, int numFloats) throws java.io.IOException
float[] array. If necessary, values
are converted from the stream’s current byte order.
The bit offset is set to zero before any data is read.
d - an array for storing the read values.offset - the index of the first element in d
that will hold read data.numFloats - the number of IEEE 32-bit single-precision
floating point numbers to read (which is one fourth of the number
of bytes).java.lang.IndexOutOfBoundsException - if offset or
numFloats is negative, or if offset +
numFloats exceeds f.length.java.lang.NullPointerException - if f is
null.java.io.EOFException - if the input stream ends before all content
was read.java.io.IOException - if some general problem happens with
accessing data.readFloat()void readFully(double[] d, int offset, int numDoubles) throws java.io.IOException
double[] array. If necessary, values
are converted from the stream’s current byte order.
The bit offset is set to zero before any data is read.
d - an array for storing the read values.offset - the index of the first element in d
that will hold read data.numDoubles - the number of IEEE 64-bit double-precision
floating point numbers to read (which is one eight of the number
of bytes).java.lang.IndexOutOfBoundsException - if offset or
numDoubles is negative, or if offset +
numDoubles exceeds d.length.java.lang.NullPointerException - if d is
null.java.io.EOFException - if the input stream ends before all content
was read.java.io.IOException - if some general problem happens with
accessing data.readDouble()long getStreamPosition() throws java.io.IOException
java.io.IOExceptionint getBitOffset() throws java.io.IOException
java.io.IOExceptionvoid setBitOffset(int bitOffset) throws java.io.IOException
java.io.IOExceptionint readBit() throws java.io.IOException
java.io.IOExceptionlong readBits(int numBits) throws java.io.IOException
java.io.IOExceptionlong length() throws java.io.IOException
java.io.IOExceptionint skipBytes(int numBytes) throws java.io.IOException
java.io.DataInputskipBytes in interface java.io.DataInputnumBytes - The number of bytes to skipnumBytesjava.io.EOFException - If end of file is reached before all bytes can be
skippedjava.io.IOException - If any other error occurslong skipBytes(long numBytes) throws java.io.IOException
java.io.IOExceptionvoid seek(long pos) throws java.io.IOException
java.io.IOExceptionvoid mark()
void reset() throws java.io.IOException
java.io.IOExceptionvoid flushBefore(long pos) throws java.io.IOException
java.io.IOExceptionvoid flush() throws java.io.IOException
java.io.IOExceptionlong getFlushedPosition()
boolean isCached()
boolean isCachedMemory()
boolean isCachedFile()
void close() throws java.io.IOException
java.io.IOException