java.io
Class FilterInputStream
- AutoCloseable, Closeable
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.
protected InputStream | in - This is the subordinate
InputStream to which method calls
are redirected
|
int | available() - Calls the
in.available() method.
|
void | close() - This method closes the input stream by closing the input stream that
this object is filtering.
|
void | mark(int readlimit) - Calls the
in.mark(int) method.
|
boolean | markSupported() - Calls the
in.markSupported() method.
|
int | read() - Calls the
in.read() method
|
int | read(byte[] buf) - Calls the
read(byte[], int, int) overloaded method.
|
int | read(byte[] buf, int offset, int len) - Calls the
in.read(byte[], int, int) method.
|
void | reset() - Calls the
in.reset() method.
|
long | skip(long numBytes) - Calls the
in.skip(long) method
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
in
protected InputStream in
This is the subordinate InputStream
to which method calls
are redirected
FilterInputStream
protected FilterInputStream(InputStream in)
Create a FilterInputStream
with the specified subordinate
InputStream
.
in
- The subordinate InputStream
mark
public void mark(int readlimit)
Calls the in.mark(int)
method.
- mark in interface InputStream
readlimit
- The parameter passed to in.mark(int)
read
public int read(byte[] buf)
throws IOException
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
.
- read in interface InputStream
buf
- The buffer to read bytes into
- The value retured from
in.read(byte[], int, int)
read
public int read(byte[] buf,
int offset,
int len)
throws IOException
Calls the in.read(byte[], int, int)
method.
- read in interface InputStream
buf
- The buffer to read bytes intooffset
- The index into the buffer to start storing byteslen
- The maximum number of bytes to read.
- The value retured from
in.read(byte[], int, int)
skip
public long skip(long numBytes)
throws IOException
Calls the in.skip(long)
method
- skip in interface InputStream
numBytes
- The requested number of bytes to skip.
- The value returned from
in.skip(long)
FilterInputStream.java -- Base class for classes that filter input
Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.