ImageReaders. Various input sources, such as
InputStreams and Files,
as well as future fast I/O sources may be "wrapped" by a suitable
implementation of this interface for use by the Image I/O API.
ImageInputStreamImpl, FileImageInputStream, FileCacheImageInputStream, MemoryCacheImageInputStream
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | flushBefore(long
a pos)long containing the length of the
stream prefix that may be flushed.Discards the initial portion of the stream prior to the indicated position. |
| public int | Returns: anint containing the bit offset between
0 and 7, inclusive.Returns the current bit offset, as an integer between 0 and 7, inclusive. |
| public ByteOrder | Returns: one ofByteOrder.BIG_ENDIAN or
ByteOrder.LITTLE_ENDIAN, indicating which byte
order is being used.Returns the byte order with which data values will be read from
this stream as an instance of the
|
| public long | Returns: the earliest legal position for seeking, as along.Returns the earliest position in the stream to which seeking may be performed. |
| public long | Returns: a long containing the position of the stream.Returns the current byte position of the stream. |
| public boolean | Returns: true if this ImageInputStream
caches data.Returns |
| public boolean | Returns: true if this ImageInputStream
caches data in a temporary file.Returns |
| public boolean | Returns: true if this ImageInputStream
caches data in main memory.Returns |
| public long | Returns: along containing the length of the
stream, if known, or else -1.Returns the total length of the stream, if known. |
| public void | |
| public int | Returns: a byte value from the stream, as an int, or -1 to indicate EOF.Reads a single byte from the stream and returns it as an integer between 0 and 255. |
| public int | Returns: the number of bytes actually read, or-1
to indicate EOF.an array of bytes to be written to. b)Reads up to |
| public int | Returns: the number of bytes actually read, or-1
to indicate EOF.an array of bytes to be written to. b, int the starting position within off, int b to write to.the maximum number of len)bytes to read.Reads up to |
| public int | Returns: anint containing the value 0
or 1.Reads a single bit from the stream and returns it as an
|
| public long | Returns: the bitstring, as along with the last bit
read stored in the least significant bit.the number of bits to read, as an numBits)int
between 0 and 64, inclusive.Reads a bitstring from the stream and returns it as a
|
| public boolean | Returns: a boolean value from the stream.Redeclares java. Reads a byte from the stream and returns a |
| public byte | Returns: a signed byte value from the stream.Redeclares java. Reads a byte from the stream and returns it as a
|
| public void | readBytes(IIOByteBuffer
an IIOByteBuffer object to be modified. buf, int the maximum number of len)bytes to read.Reads up to |
| public char | Returns: an unsigned char value from the stream.Redeclares java. Equivalent to |
| public double | Returns: a double value from the stream.Redeclares java. Reads 8 bytes from the stream, and (conceptually) concatenates
them according to the current byte order and returns the result
as a |
| public float | Returns: a float value from the stream.Redeclares java. Reads 4 bytes from the stream, and (conceptually) concatenates
them according to the current byte order and returns the result
as a |
| public void | readFully(byte[]
an array of bytes to be written to. b, int the starting position within off, int b to write to.the maximum number of len)bytes to read.Redeclares java. Reads |
| public void | readFully(byte[]
an array of b)bytes.Redeclares java. Reads |
| public void | readFully(short[]
an array of shorts to be written to. s, int the starting position within off, int s to write to.the maximum number of len)shorts to read.Reads |
| public void | readFully(char[]
an array of chars to be written to. c, int the starting position within off, int c to write to.the maximum number of len)chars to read.Reads |
| public void | readFully(int[]
an array of ints to be written to. i, int the starting position within off, int i to write to.the maximum number of len)ints to read.Reads |
| public void | readFully(long[]
an array of longs to be written to. l, int the starting position within off, int l to write to.the maximum number of len)longs to read.Reads |
| public void | readFully(float[]
an array of floats to be written to. f, int the starting position within off, int f to write to.the maximum number of len)floats to read.Reads |
| public void | readFully(double[]
an array of doubles to be written to. d, int the starting position within off, int d to write to.the maximum number of len)doubles to read.Reads |
| public int | Returns: a signed int value from the stream.Redeclares java. Reads 4 bytes from the stream, and (conceptually) concatenates
them according to the current byte order and returns the result
as an |
| public String | Returns: a String containing a line of text from the stream.Redeclares java. Reads the next line of text from the input stream. |
| public long | Returns: a signed long value from the stream.Redeclares java. Reads 8 bytes from the stream, and (conceptually) concatenates
them according to the current byte order and returns the result
as a |
| public short | Returns: a signed short value from the stream.Redeclares java. Reads two bytes from the stream, and (conceptually)
concatenates them according to the current byte order, and
returns the result as a |
| public int | Returns: an unsigned byte value from the stream.Redeclares java. Reads a byte from the stream, and (conceptually) converts it to
an int, masks it with |
| public long | Returns: an unsigned int value from the stream, as a long.Reads 4 bytes from the stream, and (conceptually) concatenates
them according to the current byte order, converts the result
to a long, masks it with |
| public int | Returns: an unsigned short value from the stream, as an int.Redeclares java. Reads two bytes from the stream, and (conceptually)
concatenates them according to the current byte order, converts
the resulting value to an |
| public String | Returns: a String read from the stream.Redeclares java. Reads in a string that has been encoded using a modified UTF-8 format. |
| public void | reset()
Returns the stream pointer to its previous position, including
the bit offset, at the time of the most recent unmatched call
to |
| public void | seek(long
a pos)long containing the desired file
pointer position.Sets the current stream position to the desired location. |
| public void | setBitOffset(int
the desired offset, as an bitOffset)int
between 0 and 7, inclusive.Sets the bit offset to an integer between 0 and 7, inclusive. |
| public void | setByteOrder(ByteOrder
one of byteOrder)ByteOrder.BIG_ENDIAN or
java.nio.ByteOrder.LITTLE_ENDIAN, indicating whether
network byte order or its reverse will be used for future
reads.Sets the desired byte order for future reads of data values from this stream. |
| public int | Returns: anint representing the number of bytes skipped.an n)int containing the number of bytes to
be skipped.Redeclares java. Moves the stream position forward by a given number of bytes. |
| public long | Returns: along representing the number of bytes
skipped.a n)long containing the number of bytes to
be skipped.Moves the stream position forward by a given number of bytes. |
| close | back to summary |
|---|---|
| public void close() throws IOException Redeclares java. Closes the stream. Attempts to access a stream that has been
closed may result in
| |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Discards the initial position of the stream prior to the current
stream position. Equivalent to
| |
| flushBefore | back to summary |
|---|---|
| public void flushBefore(long pos) throws IOException Discards the initial portion of the stream prior to the
indicated position. Attempting to seek to an offset within the
flushed portion of the stream will result in an
Calling
| |
| getBitOffset | back to summary |
|---|---|
| public int getBitOffset() throws IOException Returns the current bit offset, as an integer between 0 and 7,
inclusive. The bit offset is updated implicitly by calls to
the The bit offset is set to 0 when a stream is first
opened, and is reset to 0 by calls to
| |
| getByteOrder | back to summary |
|---|---|
| public ByteOrder getByteOrder() Returns the byte order with which data values will be read from
this stream as an instance of the
| |
| getFlushedPosition | back to summary |
|---|---|
| public long getFlushedPosition() Returns the earliest position in the stream to which seeking
may be performed. The returned value will be the maximum of
all values passed into previous calls to
| |
| getStreamPosition | back to summary |
|---|---|
| public long getStreamPosition() throws IOException Returns the current byte position of the stream. The next read will take place starting at this offset.
| |
| isCached | back to summary |
|---|---|
| public boolean isCached() Returns
| |
| isCachedFile | back to summary |
|---|---|
| public boolean isCachedFile() Returns
| |
| isCachedMemory | back to summary |
|---|---|
| public boolean isCachedMemory() Returns
| |
| length | back to summary |
|---|---|
| public long length() throws IOException Returns the total length of the stream, if known. Otherwise,
| |
| mark | back to summary |
|---|---|
| public void mark() Marks a position in the stream to be returned to by a
subsequent call to Unlike the The bit position used by the Note that it is valid for an | |
| read | back to summary |
|---|---|
| public int read() throws IOException Reads a single byte from the stream and returns it as an integer between 0 and 255. If the end of the stream is reached, -1 is returned. The bit offset within the stream is reset to zero before the read occurs.
| |
| read | back to summary |
|---|---|
| public int read(byte[] b) throws IOException Reads up to The bit offset within the stream is reset to zero before the read occurs.
| |
| read | back to summary |
|---|---|
| public int read(byte[] b, int off, int len) throws IOException Reads up to The bit offset within the stream is reset to zero before the read occurs.
| |
| readBit | back to summary |
|---|---|
| public int readBit() throws IOException Reads a single bit from the stream and returns it as an
| |
| readBits | back to summary |
|---|---|
| public long readBits(int numBits) throws IOException Reads a bitstring from the stream and returns it as a
The byte order of the stream has no effect on this method. The return value of this method is constructed as though the bits were read one at a time, and shifted into the right side of the return value, as shown by the following pseudo-code:
Note that the result of readBits(32) may thus not
be equal to that of readInt() if a reverse network
byte order is being used (i.e., getByteOrder() == false).
If the end of the stream is encountered before all the bits
have been read, a
| |
| readBoolean | back to summary |
|---|---|
| public boolean readBoolean() throws IOException Redeclares java. Reads a byte from the stream and returns a The bit offset within the stream is reset to zero before the read occurs.
| |
| readByte | back to summary |
|---|---|
| public byte readByte() throws IOException Redeclares java. Reads a byte from the stream and returns it as a
The bit offset within the stream is reset to zero before the read occurs.
| |
| readBytes | back to summary |
|---|---|
| public void readBytes(IIOByteBuffer buf, int len) throws IOException Reads up to The bit offset within the stream is reset to zero before the read occurs.
| |
| readChar | back to summary |
|---|---|
| public char readChar() throws IOException Redeclares java. Equivalent to The bit offset within the stream is reset to zero before the read occurs.
| |
| readDouble | back to summary |
|---|---|
| public double readDouble() throws IOException Redeclares java. Reads 8 bytes from the stream, and (conceptually) concatenates
them according to the current byte order and returns the result
as a The bit offset within the stream is reset to zero before the read occurs.
| |
| readFloat | back to summary |
|---|---|
| public float readFloat() throws IOException Redeclares java. Reads 4 bytes from the stream, and (conceptually) concatenates
them according to the current byte order and returns the result
as a The bit offset within the stream is reset to zero before the read occurs.
| |
| readFully | back to summary |
|---|---|
| public void readFully(byte[] b, int off, int len) throws IOException Redeclares java. Reads The bit offset within the stream is reset to zero before the read occurs.
| |
| readFully | back to summary |
|---|---|
| public void readFully(byte[] b) throws IOException Redeclares java. Reads The bit offset within the stream is reset to zero before the read occurs.
| |
| readFully | back to summary |
|---|---|
| public void readFully(short[] s, int off, int len) throws IOException Reads The bit offset within the stream is reset to zero before the read occurs.
| |
| readFully | back to summary |
|---|---|
| public void readFully(char[] c, int off, int len) throws IOException Reads The bit offset within the stream is reset to zero before the read occurs.
| |
| readFully | back to summary |
|---|---|
| public void readFully(int[] i, int off, int len) throws IOException Reads The bit offset within the stream is reset to zero before the read occurs.
| |
| readFully | back to summary |
|---|---|
| public void readFully(long[] l, int off, int len) throws IOException Reads The bit offset within the stream is reset to zero before the read occurs.
| |
| readFully | back to summary |
|---|---|
| public void readFully(float[] f, int off, int len) throws IOException Reads The bit offset within the stream is reset to zero before the read occurs.
| |
| readFully | back to summary |
|---|---|
| public void readFully(double[] d, int off, int len) throws IOException Reads The bit offset within the stream is reset to zero before the read occurs.
| |
| readInt | back to summary |
|---|---|
| public int readInt() throws IOException Redeclares java. Reads 4 bytes from the stream, and (conceptually) concatenates
them according to the current byte order and returns the result
as an The bit offset within the stream is ignored and treated as though it were zero.
| |
| readLine | back to summary |
|---|---|
| public String readLine() throws IOException Redeclares java. Reads the next line of text from the input stream. It reads
successive bytes, converting each byte separately into a
character, until it encounters a line terminator or end of
file; the characters read are then returned as a
If end of file is encountered before even one byte can be
read, then The bit offset within the stream is reset to zero before the read occurs.
| |
| readLong | back to summary |
|---|---|
| public long readLong() throws IOException Redeclares java. Reads 8 bytes from the stream, and (conceptually) concatenates
them according to the current byte order and returns the result
as a The bit offset within the stream is reset to zero before the read occurs.
| |
| readShort | back to summary |
|---|---|
| public short readShort() throws IOException Redeclares java. Reads two bytes from the stream, and (conceptually)
concatenates them according to the current byte order, and
returns the result as a The bit offset within the stream is reset to zero before the read occurs.
| |
| readUnsignedByte | back to summary |
|---|---|
| public int readUnsignedByte() throws IOException Redeclares java. Reads a byte from the stream, and (conceptually) converts it to
an int, masks it with Thus, byte values between The bit offset within the stream is reset to zero before the read occurs.
| |
| readUnsignedInt | back to summary |
|---|---|
| public long readUnsignedInt() throws IOException Reads 4 bytes from the stream, and (conceptually) concatenates
them according to the current byte order, converts the result
to a long, masks it with The bit offset within the stream is reset to zero before the read occurs.
| |
| readUnsignedShort | back to summary |
|---|---|
| public int readUnsignedShort() throws IOException Redeclares java. Reads two bytes from the stream, and (conceptually)
concatenates them according to the current byte order, converts
the resulting value to an The bit offset within the stream is reset to zero before the read occurs.
| |
| readUTF | back to summary |
|---|---|
| public String readUTF() throws IOException Redeclares java. Reads in a string that has been encoded using a
modified UTF-8
format. The general contract of First, two bytes are read and used to construct an unsigned
16-bit integer in the manner of the
If the first byte of a group matches the bit pattern
If the first byte of a group matches the bit pattern
If the first byte of a group matches the bit pattern
1110xxxx, then the group consists of that byte
a and two more bytes b and
c. If there is no byte c (because
byte a was one of the last two of the bytes to be
read), or either byte b or byte c
does not match the bit pattern 10xxxxxx, then a
UTFDataFormatException is thrown. Otherwise, the
group is converted to the character:
If the first byte of a group matches the pattern
1111xxxx or the pattern 10xxxxxx,
then a UTFDataFormatException is thrown.
If end of file is encountered at any time during this
entire process, then a After every group has been converted to a character by this
process, the characters are gathered, in the same order in
which their corresponding groups were read from the input
stream, to form a The current byte order setting is ignored. The bit offset within the stream is reset to zero before the read occurs. Note This method should not be used in the implementation of image formats that use standard UTF-8, because the modified UTF-8 used here is incompatible with standard UTF-8.
| |
| reset | back to summary |
|---|---|
| public void reset() throws IOException Returns the stream pointer to its previous position, including
the bit offset, at the time of the most recent unmatched call
to Calls to An
| |
| seek | back to summary |
|---|---|
| public void seek(long pos) throws IOException Sets the current stream position to the desired location. The next read will occur at this location. The bit offset is set to 0. An It is legal to seek past the end of the file;
a
| |
| setBitOffset | back to summary |
|---|---|
| public void setBitOffset(int bitOffset) throws IOException Sets the bit offset to an integer between 0 and 7, inclusive.
The byte offset within the stream, as returned by
| |
| setByteOrder | back to summary |
|---|---|
| public void setByteOrder(ByteOrder byteOrder) Sets the desired byte order for future reads of data values from this stream. For example, the sequence of bytes '0x01 0x02 0x03 0x04' if read as a 4-byte integer would have the value '0x01020304' using network byte order and the value '0x04030201' under the reverse byte order. The enumeration class The byte order has no effect on the results returned from
the
| |
| skipBytes | back to summary |
|---|---|
| public int skipBytes(int n) throws IOException Redeclares java. Moves the stream position forward by a given number of bytes. It is possible that this method will only be able to skip forward by a smaller number of bytes than requested, for example if the end of the stream is reached. In all cases, the actual number of bytes skipped is returned. The bit offset is set to zero prior to advancing the position.
| |
| skipBytes | back to summary |
|---|---|
| public long skipBytes(long n) throws IOException Moves the stream position forward by a given number of bytes.
This method is identical to
| |