javax.imageio.stream

Interface ImageInputStream

public interface ImageInputStream extends DataInput

An input stream for use by {@link javax.imageio.ImageReader ImageReaders}.

Since: 1.4

Method Summary
voidclose()
voidflush()
voidflushBefore(long pos)
intgetBitOffset()
ByteOrdergetByteOrder()
longgetFlushedPosition()
longgetStreamPosition()
booleanisCached()
booleanisCachedFile()
booleanisCachedMemory()
longlength()
voidmark()
intread()
intread(byte[] b)
intread(byte[] b, int offset, int length)
intreadBit()
longreadBits(int numBits)
booleanreadBoolean()
Reads a byte and checks whether or not its value is zero.
bytereadByte()
Reads a signed byte.
voidreadBytes(IIOByteBuffer buf, int numBytes)
Reads up to a specified number of bytes, and modifies a {@link IIOByteBuffer} to hold the read data.
charreadChar()
Reads an unsigned 16-bit integer.
doublereadDouble()
Reads an IEEE 64-bit double-precision floating point number.
floatreadFloat()
Reads an IEEE 32-bit single-precision floating point number.
voidreadFully(byte[] b, int offset, int numBytes)
Reads a sequence of signed 8-bit integers into a byte[] array.
voidreadFully(byte[] b)
Reads a sequence of signed 8-bit integers into a byte[] array.
voidreadFully(short[] s, int offset, int numShorts)
Reads a sequence of signed 16-bit integers into a short[] array.
voidreadFully(char[] c, int offset, int numChars)
Reads a sequence of unsigned 16-bit integers into a char[] array.
voidreadFully(int[] i, int offset, int numInts)
Reads a sequence of signed 32-bit integers into a long[] array.
voidreadFully(long[] l, int offset, int numLongs)
Reads a sequence of signed 64-bit integers into a long[] array.
voidreadFully(float[] f, int offset, int numFloats)
Reads a sequence of IEEE 32-bit single-precision floating point numbers into a float[] array.
voidreadFully(double[] d, int offset, int numDoubles)
Reads a sequence of IEEE 64-bit double-precision floating point numbers into a double[] array.
intreadInt()
Reads a signed 32-bit integer.
StringreadLine()
longreadLong()
Reads a signed 64-bit integer.
shortreadShort()
Reads an signed 16-bit integer.
intreadUnsignedByte()
Reads an unsigned byte.
longreadUnsignedInt()
Reads an unsigned 32-bit integer.
intreadUnsignedShort()
Reads an unsigned 16-bit integer.
StringreadUTF()
voidreset()
voidseek(long pos)
voidsetBitOffset(int bitOffset)
voidsetByteOrder(ByteOrder order)
intskipBytes(int numBytes)
longskipBytes(long numBytes)

Method Detail

close

public void close()

flush

public void flush()

flushBefore

public void flushBefore(long pos)

getBitOffset

public int getBitOffset()

getByteOrder

public ByteOrder getByteOrder()

getFlushedPosition

public long getFlushedPosition()

getStreamPosition

public long getStreamPosition()

isCached

public boolean isCached()

isCachedFile

public boolean isCachedFile()

isCachedMemory

public boolean isCachedMemory()

length

public long length()

mark

public void mark()

read

public int read()

read

public int read(byte[] b)

read

public int read(byte[] b, int offset, int length)

readBit

public int readBit()

readBits

public long readBits(int numBits)

readBoolean

public boolean readBoolean()
Reads a byte and checks whether or not its value is zero.

The {@linkplain #getBitOffset() bit offset} is set to zero before the byte is read.

Throws: EOFException if the input stream is at its end. IOException if some general problem happens with accessing data.

See Also: readBit readByte (byte[], int, int)

readByte

public byte readByte()
Reads a signed byte.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Throws: EOFException if the input stream is at its end. IOException if some general problem happens with accessing data.

See Also: readUnsignedByte (byte[], int, int)

readBytes

public void readBytes(IIOByteBuffer buf, int numBytes)
Reads up to a specified number of bytes, and modifies a {@link IIOByteBuffer} to hold the read data.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Parameters: buf an IIOByteBuffer that will hold the read data. numBytes the maximum number of bytes to read.

Throws: IndexOutOfBoundsException if numBytes is negative. NullPointerException if buf is null. IOException if some general problem happens with accessing data.

readChar

public char readChar()
Reads an unsigned 16-bit integer. If necessary, the value gets converted from the stream’s {@linkplain #getByteOrder() current byte order}.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

This method does the same as {@link #readUnsignedShort()}.

Throws: EOFException if the input stream ends before all two bytes were read. IOException if some general problem happens with accessing data.

See Also: (char[], int, int)

readDouble

public double readDouble()
Reads an IEEE 64-bit double-precision floating point number. If necessary, the value gets converted from the stream’s {@linkplain #getByteOrder() current byte order}.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Throws: EOFException if the input stream ends before all eight bytes were read. IOException if some general problem happens with accessing data.

See Also: (double[], int, int)

readFloat

public float readFloat()
Reads an IEEE 32-bit single-precision floating point number. If necessary, the value gets converted from the stream’s {@linkplain #getByteOrder() current byte order}.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Throws: EOFException if the input stream ends before all four bytes were read. IOException if some general problem happens with accessing data.

See Also: (float[], int, int)

readFully

public void readFully(byte[] b, int offset, int numBytes)
Reads a sequence of signed 8-bit integers into a byte[] array.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Parameters: b 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.

Throws: IndexOutOfBoundsException if offset or numBytes is negative, or if offset + numBytes exceeds b.length. NullPointerException if b is null. EOFException if the input stream ends before all content was read. IOException if some general problem happens with accessing data.

See Also: readByte

readFully

public void readFully(byte[] b)
Reads a sequence of signed 8-bit integers into a byte[] array.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Parameters: b an array for storing the read values.

Throws: NullPointerException if b is null. EOFException if the input stream ends before all content was read. IOException if some general problem happens with accessing data.

See Also: readByte (byte[], int, int)

readFully

public void readFully(short[] s, int offset, int numShorts)
Reads a sequence of signed 16-bit integers into a short[] array. If necessary, values are converted from the stream’s {@linkplain #getByteOrder() current byte order}.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Parameters: 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).

Throws: IndexOutOfBoundsException if offset or numShorts is negative, or if offset + numShorts exceeds s.length. NullPointerException if s is null. EOFException if the input stream ends before all content was read. IOException if some general problem happens with accessing data.

See Also: readShort

readFully

public void readFully(char[] c, int offset, int numChars)
Reads a sequence of unsigned 16-bit integers into a char[] array. If necessary, values are converted from the stream’s {@linkplain #getByteOrder() current byte order}.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Parameters: 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).

Throws: IndexOutOfBoundsException if offset or numChars is negative, or if offset + numChars exceeds c.length. NullPointerException if c is null. EOFException if the input stream ends before all content was read. IOException if some general problem happens with accessing data.

See Also: readChar

readFully

public void readFully(int[] i, int offset, int numInts)
Reads a sequence of signed 32-bit integers into a long[] array. If necessary, values are converted from the stream’s {@linkplain #getByteOrder() current byte order}.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Parameters: i an array for storing the read values. offset the index of the first element in i that will hold read data. numLongs the number of signed 32-bit integers to read (which is one fourth of the number of bytes).

Throws: IndexOutOfBoundsException if offset or numInts is negative, or if offset + numInts exceeds i.length. NullPointerException if i is null. EOFException if the input stream ends before all content was read. IOException if some general problem happens with accessing data.

See Also: readInt

readFully

public void readFully(long[] l, int offset, int numLongs)
Reads a sequence of signed 64-bit integers into a long[] array. If necessary, values are converted from the stream’s {@linkplain #getByteOrder() current byte order}.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Parameters: 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).

Throws: IndexOutOfBoundsException if offset or numLongs is negative, or if offset + numLongs exceeds l.length. NullPointerException if l is null. EOFException if the input stream ends before all content was read. IOException if some general problem happens with accessing data.

See Also: readLong

readFully

public void readFully(float[] f, int offset, int numFloats)
Reads a sequence of IEEE 32-bit single-precision floating point numbers into a float[] array. If necessary, values are converted from the stream’s {@linkplain #getByteOrder() current byte order}.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Parameters: 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).

Throws: IndexOutOfBoundsException if offset or numFloats is negative, or if offset + numFloats exceeds f.length. NullPointerException if f is null. EOFException if the input stream ends before all content was read. IOException if some general problem happens with accessing data.

See Also: readFloat

readFully

public void readFully(double[] d, int offset, int numDoubles)
Reads a sequence of IEEE 64-bit double-precision floating point numbers into a double[] array. If necessary, values are converted from the stream’s {@linkplain #getByteOrder() current byte order}.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Parameters: 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).

Throws: IndexOutOfBoundsException if offset or numDoubles is negative, or if offset + numDoubles exceeds d.length. NullPointerException if d is null. EOFException if the input stream ends before all content was read. IOException if some general problem happens with accessing data.

See Also: readDouble

readInt

public int readInt()
Reads a signed 32-bit integer. If necessary, the value gets converted from the stream’s {@linkplain #getByteOrder() current byte order}.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Throws: EOFException if the input stream ends before all four bytes were read. IOException if some general problem happens with accessing data.

See Also: readUnsignedInt (int[], int, int)

readLine

public String readLine()

readLong

public long readLong()
Reads a signed 64-bit integer. If necessary, the value gets converted from the stream’s {@linkplain #getByteOrder() current byte order}.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Throws: EOFException if the input stream ends before all eight bytes were read. IOException if some general problem happens with accessing data.

See Also: (long[], int, int)

readShort

public short readShort()
Reads an signed 16-bit integer. If necessary, the value gets converted from the stream’s {@linkplain #getByteOrder() current byte order}.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Throws: EOFException if the input stream ends before all two bytes were read. IOException if some general problem happens with accessing data.

See Also: readUnsignedShort readChar (short[], int, int)

readUnsignedByte

public int readUnsignedByte()
Reads an unsigned byte.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Throws: EOFException if the input stream is at its end. IOException if some general problem happens with accessing data.

See Also: readByte (byte[], int, int)

readUnsignedInt

public long readUnsignedInt()
Reads an unsigned 32-bit integer. If necessary, the value gets converted from the stream’s {@linkplain #getByteOrder() current byte order}.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

Throws: EOFException if the input stream ends before all four bytes were read. IOException if some general problem happens with accessing data.

See Also: readInt (int[], int, int)

readUnsignedShort

public int readUnsignedShort()
Reads an unsigned 16-bit integer. If necessary, the value gets converted from the stream’s {@linkplain #getByteOrder() current byte order}.

The {@linkplain #getBitOffset() bit offset} is set to zero before any data is read.

This method does the same as {@link #readChar()}.

Throws: EOFException if the input stream ends before all two bytes were read. IOException if some general problem happens with accessing data.

See Also: readShort readChar (char[], int, int)

readUTF

public String readUTF()

reset

public void reset()

seek

public void seek(long pos)

setBitOffset

public void setBitOffset(int bitOffset)

setByteOrder

public void setByteOrder(ByteOrder order)

skipBytes

public int skipBytes(int numBytes)

skipBytes

public long skipBytes(long numBytes)