Top Fields Constructors Methods
com.sun.imageio.plugins.common

public final Class SubImageInputStream

extends ImageInputStreamImpl
Class Inheritance
Imports
java.io.IOException, javax.imageio.stream.ImageInputStreamImpl, .ImageInputStream

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv int
pack-priv long
pack-priv ImageInputStream
Inherited from javax.imageio.stream.ImageInputStreamImpl:
bitOffsetbyteOrderflushedPosstreamPos

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
finalize()

Overrides javax.imageio.stream.ImageInputStreamImpl.finalize.

Finalizes this object prior to garbage collection.

public long
length()

Overrides javax.imageio.stream.ImageInputStreamImpl.length.

Implements javax.imageio.stream.ImageInputStream.length.

Returns -1L to indicate that the stream has unknown length.

public int
read()

Implements abstract javax.imageio.stream.ImageInputStreamImpl.read.

Implements javax.imageio.stream.ImageInputStream.read.

Reads a single byte from the stream and returns it as an int between 0 and 255.

public int
read(byte[]
an array of bytes to be written to.
b
,
int
the starting position within b to write to.
off
,
int
the maximum number of bytes to read.
len
)

Implements abstract javax.imageio.stream.ImageInputStreamImpl.read.

Implements javax.imageio.stream.ImageInputStream.read.

Reads up to len bytes from the stream, and stores them into b starting at index off.

public void
seek(long
a long containing the desired file pointer position.
pos
)

Overrides javax.imageio.stream.ImageInputStreamImpl.seek.

Implements javax.imageio.stream.ImageInputStream.seek.

Sets the current stream position to the desired location.

Inherited from javax.imageio.stream.ImageInputStreamImpl:
checkClosedcloseflushflushBeforegetBitOffsetgetByteOrdergetFlushedPositiongetStreamPositionisCachedisCachedFileisCachedMemorymarkreadreadBitreadBitsreadBooleanreadBytereadBytesreadCharreadDoublereadFloatreadFullyreadFullyreadFullyreadFullyreadFullyreadFullyreadFullyreadFullyreadIntreadLinereadLongreadShortreadUnsignedBytereadUnsignedIntreadUnsignedShortreadUTFresetsetBitOffsetsetByteOrderskipBytesskipBytes

Field Detail

lengthback to summary
pack-priv int length
startingLengthback to summary
pack-priv int startingLength
startingPosback to summary
pack-priv long startingPos
streamback to summary
pack-priv ImageInputStream stream

Constructor Detail

SubImageInputStreamback to summary
public SubImageInputStream(ImageInputStream stream, int length) throws IOException

Method Detail

finalizeback to summary
protected void finalize() throws Throwable

Overrides javax.imageio.stream.ImageInputStreamImpl.finalize.

Doc from javax.imageio.stream.ImageInputStreamImpl.finalize.

Finalizes this object prior to garbage collection. The close method is called to close any open input source. This method should not be called from application code.

Annotations
@SuppressWarnings:removal
Exceptions
Throwable:
if an error occurs during superclass finalization.
lengthback to summary
public long length()

Overrides javax.imageio.stream.ImageInputStreamImpl.length.

Implements javax.imageio.stream.ImageInputStream.length.

Doc from javax.imageio.stream.ImageInputStreamImpl.length.

Returns -1L to indicate that the stream has unknown length. Subclasses must override this method to provide actual length information.

Returns:long

-1L to indicate unknown length.

readback to summary
public int read() throws IOException

Implements abstract javax.imageio.stream.ImageInputStreamImpl.read.

Implements javax.imageio.stream.ImageInputStream.read.

Doc from javax.imageio.stream.ImageInputStreamImpl.read.

Reads a single byte from the stream and returns it as an int between 0 and 255. If EOF is reached, -1 is returned.

Subclasses must provide an implementation for this method. The subclass implementation should update the stream position before exiting.

The bit offset within the stream must be reset to zero before the read occurs.

Returns:int

the value of the next byte in the stream, or -1 if EOF is reached.

Exceptions
IOException:
if the stream has been closed.
readback to summary
public int read(byte[] b, int off, int len) throws IOException

Implements abstract javax.imageio.stream.ImageInputStreamImpl.read.

Implements javax.imageio.stream.ImageInputStream.read.

Doc from javax.imageio.stream.ImageInputStreamImpl.read.

Reads up to len bytes from the stream, and stores them into b starting at index off. If no bytes can be read because the end of the stream has been reached, -1 is returned.

The bit offset within the stream must be reset to zero before the read occurs.

Subclasses must provide an implementation for this method. The subclass implementation should update the stream position before exiting.

Parameters
b:byte[]

an array of bytes to be written to.

off:int

the starting position within b to write to.

len:int

the maximum number of bytes to read.

Returns:int

the number of bytes actually read, or -1 to indicate EOF.

Exceptions
IOException:
if an I/O error occurs.
seekback to summary
public void seek(long pos) throws IOException

Overrides javax.imageio.stream.ImageInputStreamImpl.seek.

Implements javax.imageio.stream.ImageInputStream.seek.

Doc from javax.imageio.stream.ImageInputStream.seek.

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 IndexOutOfBoundsException will be thrown if pos is smaller than the flushed position (as returned by getflushedPosition).

It is legal to seek past the end of the file; a java.io.EOFException will be thrown only if a read is performed.

Parameters
pos:long

a long containing the desired file pointer position.

Exceptions
IOException:
if any other I/O error occurs.