org.apache.batik.ext.awt.image.codec.util

Class ForwardSeekableStream

public class ForwardSeekableStream extends SeekableStream

A subclass of SeekableStream that may be used to wrap a regular InputStream efficiently. Seeking backwards is not supported.
Constructor Summary
ForwardSeekableStream(InputStream src)
Constructs a InputStreamForwardSeekableStream from a regular InputStream.
Method Summary
intavailable()
Forwards the request to the real InputStream.
booleancanSeekBackwards()
Returns false since seking backwards is not supported.
voidclose()
Forwards the request to the real InputStream.
longgetFilePointer()
Returns the current position in the stream (bytes read).
voidmark(int readLimit)
Forwards the request to the real InputStream.
booleanmarkSupported()
Forwards the request to the real InputStream.
intread()
Forwards the request to the real InputStream.
intread(byte[] b, int off, int len)
Forwards the request to the real InputStream.
voidreset()
Forwards the request to the real InputStream.
voidseek(long pos)
Seeks forward to the given position in the stream.
longskip(long n)
Forwards the request to the real InputStream.

Constructor Detail

ForwardSeekableStream

public ForwardSeekableStream(InputStream src)
Constructs a InputStreamForwardSeekableStream from a regular InputStream.

Method Detail

available

public final int available()
Forwards the request to the real InputStream.

canSeekBackwards

public final boolean canSeekBackwards()
Returns false since seking backwards is not supported.

close

public final void close()
Forwards the request to the real InputStream.

getFilePointer

public final long getFilePointer()
Returns the current position in the stream (bytes read).

mark

public final void mark(int readLimit)
Forwards the request to the real InputStream. We use {@link SeekableStream#markPos}

markSupported

public boolean markSupported()
Forwards the request to the real InputStream.

read

public final int read()
Forwards the request to the real InputStream.

read

public final int read(byte[] b, int off, int len)
Forwards the request to the real InputStream.

reset

public final void reset()
Forwards the request to the real InputStream. We use {@link SeekableStream#markPos}

seek

public final void seek(long pos)
Seeks forward to the given position in the stream. If pos is smaller than the current position as returned by getFilePointer(), nothing happens.

skip

public final long skip(long n)
Forwards the request to the real InputStream.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.