Spec-Zone .ru
спецификации, руководства, описания, API
Contents | Prev | Next | Index

22.9 The Class java.io.FilterInputStream

A FilterInputStream contains some other input stream, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality. The class FilterInputStream itself simply overrides all methods of InputStream with versions that pass all requests to the contained input stream. Subclasses of FilterInputStream may further override some of these methods and may also provide additional methods and fields.

public class FilterInputStream extends InputStream {
	protected InputStream in;
	protected FilterInputStream(InputStream in);
	public int read() throws IOException;
	public int read(byte[] b)
		throws IOException, NullPointerException;
	public int read(byte[] b, int off, int len)
		throws IOException, NullPointerException,
			IndexOutOfBoundsException;
	public long skip(long n) throws IOException;
	public int available() throws IOException;
	public void close() throws IOException;
	public void mark(int readlimit);
	public void reset() throws IOException;
	public boolean markSupported();
}

22.9.1 protected InputStream in;

The input stream to be filtered.

22.9.2 protected FilterInputStream(InputStream in)

This constructor initializes a newly created FilterInputStream by assigning the argument in to the field this.in so as to remember it for later use.

22.9.3 public int read() throws IOException

This method simply performs in.read() and returns the result.

Implements the read method of InputStream (§22.3.1).

22.9.4 public int read(byte[] b)
throws IOException, NullPointerException

This method simply performs the call read(b, 0, b.length) and returns the result. It is important that it does not do in.read(b) instead; certain subclasses of FilterInputStream depend on the implementation strategy actually used.

Overrides the read method of InputStream (§22.3.2).

22.9.5 public int read(byte[] b, int off, int len)
throws IOException, NullPointerException, IndexOutOfBoundsException

This method simply performs in.read(b, off, len) and returns the result.

Overrides the read method of InputStream (§22.3.3).

22.9.6 public long skip(long n) throws IOException

This method simply performs in.skip() and returns the result.

Overrides the skip method of InputStream (§22.3.4).

22.9.7 public int available() throws IOException

This method simply performs in.available() and returns the result.

Overrides the available method of InputStream (§22.3.5).

22.9.8 public void close() throws IOException

This method simply performs in.close().

Overrides the close method of InputStream (§22.3.6).

22.9.9 public void mark(int readlimit)

This method simply performs in.mark().

Overrides the mark method of InputStream (§22.3.7).

22.9.10 public void reset() throws IOException

This method simply performs in.reset().

Overrides the reset method of InputStream (§22.3.8).

22.9.11 public boolean markSupported()

This method simply performs in.markSupported() and returns whatever value is returned from that invocation.

Overrides the markSupported method of InputStream (§22.3.9).


Contents | Prev | Next | Index

Java Language Specification (HTML generated by Suzette Pelouch on February 24, 1998)
Copyright © 1996 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to doug.kramer@sun.com

free hit counter