KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > io > FilterReader


1 /*
2  * @(#)FilterReader.java 1.17 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.io;
9
10
11 /**
12  * Abstract class for reading filtered character streams.
13  * The abstract class <code>FilterReader</code> itself
14  * provides default methods that pass all requests to
15  * the contained stream. Subclasses of <code>FilterReader</code>
16  * should override some of these methods and may also provide
17  * additional methods and fields.
18  *
19  * @version 1.17, 03/12/19
20  * @author Mark Reinhold
21  * @since JDK1.1
22  */

23
24 public abstract class FilterReader extends Reader JavaDoc {
25
26     /**
27      * The underlying character-input stream.
28      */

29     protected Reader JavaDoc in;
30
31     /**
32      * Create a new filtered reader.
33      *
34      * @param in a Reader object providing the underlying stream.
35      * @throws NullPointerException if <code>in</code> is <code>null</code>
36      */

37     protected FilterReader(Reader JavaDoc in) {
38     super(in);
39     this.in = in;
40     }
41
42     /**
43      * Read a single character.
44      *
45      * @exception IOException If an I/O error occurs
46      */

47     public int read() throws IOException JavaDoc {
48     return in.read();
49     }
50
51     /**
52      * Read characters into a portion of an array.
53      *
54      * @exception IOException If an I/O error occurs
55      */

56     public int read(char cbuf[], int off, int len) throws IOException JavaDoc {
57     return in.read(cbuf, off, len);
58     }
59
60     /**
61      * Skip characters.
62      *
63      * @exception IOException If an I/O error occurs
64      */

65     public long skip(long n) throws IOException JavaDoc {
66     return in.skip(n);
67     }
68
69     /**
70      * Tell whether this stream is ready to be read.
71      *
72      * @exception IOException If an I/O error occurs
73      */

74     public boolean ready() throws IOException JavaDoc {
75     return in.ready();
76     }
77
78     /**
79      * Tell whether this stream supports the mark() operation.
80      */

81     public boolean markSupported() {
82     return in.markSupported();
83     }
84
85     /**
86      * Mark the present position in the stream.
87      *
88      * @exception IOException If an I/O error occurs
89      */

90     public void mark(int readAheadLimit) throws IOException JavaDoc {
91     in.mark(readAheadLimit);
92     }
93
94     /**
95      * Reset the stream.
96      *
97      * @exception IOException If an I/O error occurs
98      */

99     public void reset() throws IOException JavaDoc {
100     in.reset();
101     }
102
103     /**
104      * Close the stream.
105      *
106      * @exception IOException If an I/O error occurs
107      */

108     public void close() throws IOException JavaDoc {
109     in.close();
110     }
111
112 }
113
Popular Tags