javax.imageio.stream

Interface ImageInputStream

All Superinterfaces:
DataInput
Known Subinterfaces:
ImageOutputStream
Known Implementing Classes:
FileCacheImageInputStream, FileCacheImageOutputStream, FileImageInputStream, FileImageOutputStream, ImageInputStreamImpl, ImageOutputStreamImpl, JPEGImageInputStream, MemoryCacheImageInputStream, MemoryCacheImageOutputStream

public interface ImageInputStream
extends DataInput

An input stream for use by ImageReaders.
Since:
1.4

Method Summary

void
close()
void
flush()
void
flushBefore(long pos)
int
getBitOffset()
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.
String
readLine()
long
readLong()
Reads a signed 64-bit integer.
short
readShort()
Reads an signed 16-bit integer.
String
readUTF()
int
readUnsignedByte()
Reads an unsigned byte.
long
readUnsignedInt()
Reads an unsigned 32-bit integer.
int
readUnsignedShort()
Reads an unsigned 16-bit integer.
void
reset()
void
seek(long pos)
void
setBitOffset(int bitOffset)
void
setByteOrder(ByteOrder order)
int
skipBytes(int numBytes)
long
skipBytes(long numBytes)

Methods inherited from interface java.io.DataInput

readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUTF, readUnsignedByte, readUnsignedShort, skipBytes

Method Details

close

public void close()
            throws IOException

flush

public void flush()
            throws IOException

flushBefore

public void flushBefore(long pos)
            throws IOException

getBitOffset

public int getBitOffset()
            throws IOException

getByteOrder

public ByteOrder getByteOrder()

getFlushedPosition

public long getFlushedPosition()

getStreamPosition

public long getStreamPosition()
            throws IOException

isCached

public boolean isCached()

isCachedFile

public boolean isCachedFile()

isCachedMemory

public boolean isCachedMemory()

length

public long length()
            throws IOException

mark

public void mark()

read

public int read()
            throws IOException

read

public int read(byte[] b)
            throws IOException

read

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

readBit

public int readBit()
            throws IOException

readBits

public long readBits(int numBits)
            throws IOException

readBoolean

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

The bit offset is set to zero before the byte is read.

Specified by:
readBoolean in interface DataInput
Throws:
IOException - if some general problem happens with accessing data.

readByte

public byte readByte()
            throws IOException
Reads a signed byte.

The bit offset is set to zero before any data is read.

Specified by:
readByte in interface DataInput
Throws:
IOException - if some general problem happens with accessing data.

readBytes

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

The 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()
            throws IOException
Reads an unsigned 16-bit integer. If necessary, the value gets converted from the stream’s current byte order.

The bit offset is set to zero before any data is read.

This method does the same as readUnsignedShort().

Specified by:
readChar in interface DataInput
Throws:
IOException - if some general problem happens with accessing data.

readDouble

public double readDouble()
            throws IOException
Reads an IEEE 64-bit double-precision floating point number. If necessary, the value gets converted from the stream’s current byte order.

The bit offset is set to zero before any data is read.

Specified by:
readDouble in interface DataInput
Throws:
IOException - if some general problem happens with accessing data.

readFloat

public float readFloat()
            throws IOException
Reads an IEEE 32-bit single-precision floating point number. If necessary, the value gets converted from the stream’s current byte order.

The bit offset is set to zero before any data is read.

Specified by:
readFloat in interface DataInput
Throws:
IOException - if some general problem happens with accessing data.

readFully

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

The bit offset is set to zero before any data is read.

Specified by:
readFully in interface DataInput
Parameters:
b - an array for storing the read values.
Throws:
NullPointerException - if b is null.
IOException - if some general problem happens with accessing data.

readFully

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

The bit offset is set to zero before any data is read.

Specified by:
readFully in interface DataInput
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.
IOException - if some general problem happens with accessing data.
See Also:
readByte()

readFully

public void readFully(char[] c,
                      int offset,
                      int numChars)
            throws IOException
Reads a sequence of unsigned 16-bit integers into a 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.

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.
IOException - if some general problem happens with accessing data.
See Also:
readChar()

readFully

public void readFully(double[] d,
                      int offset,
                      int numDoubles)
            throws IOException
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 current byte order.

The 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.
IOException - if some general problem happens with accessing data.
See Also:
readDouble()

readFully

public void readFully(float[] f,
                      int offset,
                      int numFloats)
            throws IOException
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 current byte order.

The bit offset is set to zero before any data is read.

Parameters:
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.
IOException - if some general problem happens with accessing data.
See Also:
readFloat()

readFully

public void readFully(int[] i,
                      int offset,
                      int numInts)
            throws IOException
Reads a sequence of signed 32-bit integers into a 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.

Parameters:
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).
Throws:
IndexOutOfBoundsException - if offset or numInts is negative, or if offset + numInts exceeds i.length.
NullPointerException - if i is null.
IOException - if some general problem happens with accessing data.
See Also:
readInt()

readFully

public void readFully(long[] l,
                      int offset,
                      int numLongs)
            throws IOException
Reads a sequence of signed 64-bit integers into a 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.

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.
IOException - if some general problem happens with accessing data.
See Also:
readLong()

readFully

public void readFully(short[] s,
                      int offset,
                      int numShorts)
            throws IOException
Reads a sequence of signed 16-bit integers into a 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.

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.
IOException - if some general problem happens with accessing data.
See Also:
readShort()

readInt

public int readInt()
            throws IOException
Reads a signed 32-bit integer. If necessary, the value gets converted from the stream’s current byte order.

The bit offset is set to zero before any data is read.

Specified by:
readInt in interface DataInput
Throws:
IOException - if some general problem happens with accessing data.

readLine

public String readLine()
            throws IOException
Specified by:
readLine in interface DataInput

readLong

public long readLong()
            throws IOException
Reads a signed 64-bit integer. If necessary, the value gets converted from the stream’s current byte order.

The bit offset is set to zero before any data is read.

Specified by:
readLong in interface DataInput
Throws:
IOException - if some general problem happens with accessing data.

readShort

public short readShort()
            throws IOException
Reads an signed 16-bit integer. If necessary, the value gets converted from the stream’s current byte order.

The bit offset is set to zero before any data is read.

Specified by:
readShort in interface DataInput
Throws:
IOException - if some general problem happens with accessing data.

readUTF

public String readUTF()
            throws IOException
Specified by:
readUTF in interface DataInput

readUnsignedByte

public int readUnsignedByte()
            throws IOException
Reads an unsigned byte.

The bit offset is set to zero before any data is read.

Specified by:
readUnsignedByte in interface DataInput
Throws:
IOException - if some general problem happens with accessing data.

readUnsignedInt

public long readUnsignedInt()
            throws IOException
Reads an unsigned 32-bit integer. If necessary, the value gets converted from the stream’s current byte order.

The bit offset is set to zero before any data is read.

Throws:
IOException - if some general problem happens with accessing data.

readUnsignedShort

public int readUnsignedShort()
            throws IOException
Reads an unsigned 16-bit integer. If necessary, the value gets converted from the stream’s current byte order.

The bit offset is set to zero before any data is read.

This method does the same as readChar().

Specified by:
readUnsignedShort in interface DataInput
Throws:
IOException - if some general problem happens with accessing data.

reset

public void reset()
            throws IOException

seek

public void seek(long pos)
            throws IOException

setBitOffset

public void setBitOffset(int bitOffset)
            throws IOException

setByteOrder

public void setByteOrder(ByteOrder order)

skipBytes

public int skipBytes(int numBytes)
            throws IOException
Specified by:
skipBytes in interface DataInput

skipBytes

public long skipBytes(long numBytes)
            throws IOException

ImageInputStream.java Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.