KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > io > input > ProxyReader


1 /*
2  * Copyright 2002-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.io.input;
17
18 import java.io.FilterReader JavaDoc;
19 import java.io.IOException JavaDoc;
20 import java.io.Reader JavaDoc;
21
22 /**
23  * A Proxy stream which acts as expected, that is it passes the method
24  * calls on to the proxied stream and doesn't change which methods are
25  * being called.
26  *
27  * It is an alternative base class to FilterReader
28  * to increase reusability, because FilterReader changes the
29  * methods being called, such as read(char[]) to read(char[], int, int).
30  */

31 public abstract class ProxyReader extends FilterReader JavaDoc {
32
33     private Reader JavaDoc proxy;
34
35     /**
36      * Constructs a new ProxyReader.
37      * @param proxy Reader to delegate to
38      */

39     public ProxyReader(Reader JavaDoc proxy) {
40         super(proxy);
41         this.proxy = proxy;
42     }
43
44     /** @see java.io.Reader#read() */
45     public int read() throws IOException JavaDoc {
46         return this.proxy.read();
47     }
48
49     /** @see java.io.Reader#read(char[]) */
50     public int read(char[] chr) throws IOException JavaDoc {
51         return this.proxy.read(chr);
52     }
53
54     /** @see java.io.Reader#read(char[], int, int) */
55     public int read(char[] chr, int st, int end) throws IOException JavaDoc {
56         return this.proxy.read(chr, st, end);
57     }
58
59     /** @see java.io.Reader#skip(long) */
60     public long skip(long ln) throws IOException JavaDoc {
61         return this.proxy.skip(ln);
62     }
63
64     /** @see java.io.Reader#ready() */
65     public boolean ready() throws IOException JavaDoc {
66         return this.proxy.ready();
67     }
68
69     /** @see java.io.Reader#close() */
70     public void close() throws IOException JavaDoc {
71         this.proxy.close();
72     }
73
74     /** @see java.io.Reader#mark(int) */
75     public synchronized void mark(int idx) throws IOException JavaDoc {
76         this.proxy.mark(idx);
77     }
78
79     /** @see java.io.Reader#reset() */
80     public synchronized void reset() throws IOException JavaDoc {
81         this.proxy.reset();
82     }
83
84     /** @see java.io.Reader#markSupported() */
85     public boolean markSupported() {
86         return this.proxy.markSupported();
87     }
88
89 }
90
Popular Tags