|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||


, FileCacheImageOutputStream
, FileImageInputStream
, FileImageOutputStream
, ImageInputStreamImpl
, ImageOutputStreamImpl
, MemoryCacheImageInputStream
, MemoryCacheImageOutputStream

public interface ImageInputStream

A seekable input stream interface for use by
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

| Method Summary | |
|---|---|
void |
close
Closes the stream. |
void |
flush
Discards the initial position of the stream prior to the current stream position. |
void |
flushBefore
Discards the initial portion of the stream prior to the indicated postion. |
int |
getBitOffset
Returns the current bit offset, as an integer between 0 and 7, inclusive. |
ByteOrder |
getByteOrder
Returns the byte order with which data values will be read from this stream as an instance of the java.nio.ByteOrder enumeration. |
long |
getFlushedPosition
Returns the earliest position in the stream to which seeking may be performed. |
long |
getStreamPosition
Returns the current byte position of the stream. |
boolean |
isCached
Returns true if this ImageInputStream
caches data itself in order to allow seeking backwards. |
boolean |
isCachedFile
Returns true if this ImageInputStream
caches data itself in order to allow seeking backwards, and
the cache is kept in a temporary file. |
boolean |
isCachedMemory
Returns true if this ImageInputStream
caches data itself in order to allow seeking backwards, and
the cache is kept in main memory. |
long |
length
Returns the total length of the stream, if known. |
void |
mark
Marks a position in the stream to be returned to by a subsequent call to reset. |
int |
read
Reads a single byte from the stream and returns it as an integer between 0 and 255. |
int |
read
Reads up to b.length bytes from the stream, and
stores them into b starting at index 0. |
int |
read
Reads up to len bytes from the stream, and stores
them into b starting at index off. |
int |
readBit
Reads a single bit from the stream and returns it as an int with the value 0 or
1. |
long |
readBits
Reads a bitstring from the stream and returns it as a long, with the first bit read becoming the most
significant bit of the output. |
boolean |
readBoolean
Reads a byte from the stream and returns a boolean
value of true if it is nonzero, false
if it is zero. |
byte |
readByte
Reads a byte from the stream and returns it as a byte value. |
void |
readBytes
Reads up to len bytes from the stream, and
modifies the supplied IIOByteBuffer to indicate
the byte array, offset, and length where the data may be found. |
char |
readChar
Equivalent to readUnsignedShort, except that the
result is returned using the char datatype. |
double |
readDouble
Reads 8 bytes from the stream, and (conceptually) concatenates them according to the current byte order and returns the result as a double. |
float |
readFloat
Reads 4 bytes from the stream, and (conceptually) concatenates them according to the current byte order and returns the result as a float. |
void |
readFully
Reads b.length bytes from the stream, and stores them
into b starting at index 0. |
void |
readFully
Reads len bytes from the stream, and stores them
into b starting at index off. |
void |
readFully
Reads len chars (unsigned 16-bit integers) from the
stream according to the current byte order, and
stores them into c starting at index
off. |
void |
readFully
Reads len doubles (64-bit IEEE double-precision
floats) from the stream according to the current byte order,
and stores them into d starting at
index off. |
void |
readFully
Reads len floats (32-bit IEEE single-precision
floats) from the stream according to the current byte order,
and stores them into f starting at
index off. |
void |
readFully
Reads len ints (signed 32-bit integers) from the
stream according to the current byte order, and
stores them into i starting at index
off. |
void |
readFully
Reads len longs (signed 64-bit integers) from the
stream according to the current byte order, and
stores them into l starting at index
off. |
void |
readFully
Reads len shorts (signed 16-bit integers) from the
stream according to the current byte order, and
stores them into s starting at index
off. |
int |
readInt
Reads 4 bytes from the stream, and (conceptually) concatenates them according to the current byte order and returns the result as an int. |
String |
readLine
Reads the next line of text from the input stream. |
long |
readLong
Reads 8 bytes from the stream, and (conceptually) concatenates them according to the current byte order and returns the result as a long. |
short |
readShort
Reads two bytes from the stream, and (conceptually) concatenates them according to the current byte order, and returns the result as a short value. |
int |
readUnsignedByte
Reads a byte from the stream, and (conceptually) converts it to an int, masks it with 0xff in order to strip off
any sign-extension bits, and returns it as a byte
value. |
long |
readUnsignedInt
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 0xffffffffL in order to
strip off any sign-extension bits, and returns the result as an
unsigned long value. |
int |
readUnsignedShort
Reads two bytes from the stream, and (conceptually) concatenates them according to the current byte order, converts the resulting value to an int, masks it with
0xffff in order to strip off any sign-extension
buts, and returns the result as an unsigned int
value. |
String |
readUTF
Reads in a string that has been encoded using a modified UTF-8 format. |
void |
reset
Returns the file pointer to its previous position, including the bit offset, at the time of the most recent unmatched call to mark. |
void |
seek
Sets the current stream position to the desired location. |
void |
setBitOffset
Sets the bit offset to an integer between 0 and 7, inclusive. |
void |
setByteOrder
Sets the desired byte order for future reads of data values from this stream. |
int |
skipBytes
Moves the stream position forward by a given number of bytes. |
long |
skipBytes
Moves the stream position forward by a given number of bytes. |
| Method Detail |
|---|

void setByteOrder(ByteOrder![]()
![]()
byteOrder)
The enumeration class java.nio.ByteOrder is
used to specify the byte order. A value of
ByteOrder.BIG_ENDIAN specifies so-called
big-endian or network byte order, in which the high-order byte
comes first. Motorola and Sparc processors store data in this
format, while Intel processors store data in the reverse
ByteOrder.LITTLE_ENDIAN order.
The byte order has no effect on the results returned from
the readBits method (or the value written by
ImageOutputStream.writeBits).
byteOrder - one of ByteOrder.BIG_ENDIAN or
java.nio.ByteOrder.LITTLE_ENDIAN, indicating whether
network byte order or its reverse will be used for future
reads.ByteOrder
,
getByteOrder()
,
readBits(int)


ByteOrder![]()
![]()
getByteOrder()
java.nio.ByteOrder enumeration.
ByteOrder.BIG_ENDIAN or
ByteOrder.LITTLE_ENDIAN, indicating which byte
order is being used.ByteOrder
,
setByteOrder(java.nio.ByteOrder)


int read()
throws IOException

The bit offset within the stream is reset to zero before the read occurs.
IOException

- if an I/O error occurs.

int read(byte[] b)
throws IOException

b.length bytes from the stream, and
stores them into b starting at index 0. The
number of bytes read is returned. If no bytes can be read
because the end of the stream has been reached, -1 is returned.
The bit offset within the stream is reset to zero before the read occurs.
b - an array of bytes to be written to.
-1
to indicate EOF.
NullPointerException

- if b is
null.
IOException

- if an I/O error occurs.

int read(byte[] b,
int off,
int len)
throws IOException

len bytes from the stream, and stores
them into b starting at index off.
The number of bytes read is returned. If no bytes can be read
because the end of the stream has been reached, -1
is returned.
The bit offset within the stream is reset to zero before the read occurs.
b - an array of bytes to be written to.off - the starting position within b to write to.len - the maximum number of bytes to read.
-1
to indicate EOF.
NullPointerException

- if b is
null.
IndexOutOfBoundsException

- if off is
negative, len is negative, or off +
len is greater than b.length.
IOException

- if an I/O error occurs.

void readBytes(IIOByteBuffer![]()
![]()
buf, int len) throws IOException
![]()
![]()
len bytes from the stream, and
modifies the supplied IIOByteBuffer to indicate
the byte array, offset, and length where the data may be found.
The caller should not attempt to modify the data found in the
IIOByteBuffer.
The bit offset within the stream is reset to zero before the read occurs.
buf - an IIOByteBuffer object to be modified.len - the maximum number of bytes to read.
IndexOutOfBoundsException

- if len is
negative.
NullPointerException

- if buf is
null.
IOException

- if an I/O error occurs.

boolean readBoolean()
throws IOException

boolean
value of true if it is nonzero, false
if it is zero.
The bit offset within the stream is reset to zero before the read occurs.
readBoolean

in interface DataInput

EOFException

- if the end of the stream is reached.
IOException

- if an I/O error occurs.

byte readByte()
throws IOException

byte value. Byte values between 0x00
and 0x7f represent integer values between
0 and 127. Values between
0x80 and 0xff represent negative
values from -128 to /1.
The bit offset within the stream is reset to zero before the read occurs.
readByte

in interface DataInput

EOFException

- if the end of the stream is reached.
IOException

- if an I/O error occurs.

int readUnsignedByte()
throws IOException

0xff in order to strip off
any sign-extension bits, and returns it as a byte
value.
Thus, byte values between 0x00 and
0x7f are simply returned as integer values between
0 and 127. Values between
0x80 and 0xff, which normally
represent negative bytevalues, will be mapped into
positive integers between 128 and
255.
The bit offset within the stream is reset to zero before the read occurs.
readUnsignedByte

in interface DataInput

EOFException

- if the end of the stream is reached.
IOException

- if an I/O error occurs.

short readShort()
throws IOException

short value.
The bit offset within the stream is reset to zero before the read occurs.
readShort

in interface DataInput

EOFException

- if the stream reaches the end before
reading all the bytes.
IOException

- if an I/O error occurs.getByteOrder()


int readUnsignedShort()
throws IOException

int, masks it with
0xffff in order to strip off any sign-extension
buts, and returns the result as an unsigned int
value.
The bit offset within the stream is reset to zero before the read occurs.
readUnsignedShort

in interface DataInput

EOFException

- if the stream reaches the end before
reading all the bytes.
IOException

- if an I/O error occurs.getByteOrder()


char readChar()
throws IOException

readUnsignedShort, except that the
result is returned using the char datatype.
The bit offset within the stream is reset to zero before the read occurs.
readChar

in interface DataInput

EOFException

- if the stream reaches the end before
reading all the bytes.
IOException

- if an I/O error occurs.readUnsignedShort()


int readInt()
throws IOException

int.
The bit offset within the stream is ignored and treated as though it were zero.
readInt

in interface DataInput

EOFException

- if the stream reaches the end before
reading all the bytes.
IOException

- if an I/O error occurs.getByteOrder()


long readUnsignedInt()
throws IOException

0xffffffffL in order to
strip off any sign-extension bits, and returns the result as an
unsigned long value.
The bit offset within the stream is reset to zero before the read occurs.
EOFException

- if the stream reaches the end before
reading all the bytes.
IOException

- if an I/O error occurs.getByteOrder()
