Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.io

Class FilterInputStream

java.lang.Object
|
+--java.io.InputStream
   |
   +--java.io.FilterInputStream


public class FilterInputStream

extends InputStream

This is the common superclass of all standard classes that filter input. It acts as a layer on top of an underlying InputStream and simply redirects calls made to it to the subordinate InputStream instead. Subclasses of this class perform additional filtering functions in addition to simply redirecting the call.

This class is not abstract. However, since it only redirects calls to a subordinate InputStream without adding any functionality on top of it, this class should not be used directly. Instead, various subclasses of this class should be used. This is enforced with a protected constructor. Do not try to hack around it.

When creating a subclass of FilterInputStream, override the appropriate methods to implement the desired filtering. However, note that the read(byte[]) method does not need to be overridden as this class redirects calls to that method to read(byte[], int, int) instead of to the subordinate InputStream read(byte[]) method.

Authors:

Field Summary

java.io.InputStreamin

This is the subordinate InputStream to which method calls are redirected

Constructor Summary

FilterInputStream(java.io.InputStream in)

Create a FilterInputStream with the specified subordinate InputStream.

Method Summary

intavailable()

Calls the in.available() method.
voidclose()

This method closes the input stream by closing the input stream that this object is filtering.
voidmark(int readlimit)

Calls the in.mark(int) method.
booleanmarkSupported()

Calls the in.markSupported() method.
intread()

Calls the in.read() method
intread(byte[] buf)

Calls the read(byte[], int, int) overloaded method.
intread(byte[] buf, int offset, int len)

Calls the in.read(byte[], int, int) method.
voidreset()

Calls the in.reset() method.
longskip(long num_bytes)

Calls the in.skip(long) method

Field Details

in

protected InputStream in

This is the subordinate InputStream to which method calls are redirected


Constructor Details

FilterInputStream

protected FilterInputStream(java.io.InputStream in)

Create a FilterInputStream with the specified subordinate InputStream.

Parameters:


Method Details

available

public int available()

Calls the in.available() method.

Returns:

Throws:


close

public void close()

This method closes the input stream by closing the input stream that this object is filtering. Future attempts to access this stream may throw an exception.

Throws:


mark

public void mark(int readlimit)

Calls the in.mark(int) method.

Parameters:


markSupported

public boolean markSupported()

Calls the in.markSupported() method.

Returns:


read

public int read()

Calls the in.read() method

Returns:

Throws:


read

public int read(byte[] buf)

Calls the read(byte[], int, int) overloaded method. Note that this method does not redirect its call directly to a corresponding method in in. This allows subclasses to override only the three argument version of read.

Parameters:

Returns:

Throws:


read

public int read(byte[] buf, int offset, int len)

Calls the in.read(byte[], int, int) method.

Parameters:

Returns:

Throws:


reset

public void reset()

Calls the in.reset() method.

Throws:


skip

public long skip(long num_bytes)

Calls the in.skip(long) method

Parameters:

Returns:

Throws: