1 |
/* FilterWriter.java -- Parent class for output streams that filter |
/* FilterWriter.java -- Parent class for output streams that filter |
2 |
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. |
Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
52 |
* underlying stream. Subclasses provide actual filtering. |
* underlying stream. Subclasses provide actual filtering. |
53 |
* |
* |
54 |
* @author Aaron M. Renn (arenn@urbanophile.com) |
* @author Aaron M. Renn (arenn@urbanophile.com) |
55 |
* @author Tom Tromey <tromey@cygnus.com> |
* @author Tom Tromey <tromey@cygnus.com> |
56 |
*/ |
*/ |
57 |
public abstract class FilterWriter extends Writer |
public abstract class FilterWriter extends Writer |
58 |
{ |
{ |
59 |
|
/* |
60 |
/*************************************************************************/ |
* Instance Variables |
61 |
|
*/ |
62 |
/* |
|
63 |
* Instance Variables |
/** |
64 |
*/ |
* This is the subordinate <code>Writer</code> that this class |
65 |
|
* redirects its method calls to. |
66 |
/** |
*/ |
67 |
* This is the subordinate <code>Writer</code> that this class |
protected Writer out; |
68 |
* redirects its method calls to. |
|
69 |
*/ |
/*************************************************************************/ |
70 |
protected Writer out; |
|
71 |
|
/* |
72 |
/*************************************************************************/ |
* Constructors |
73 |
|
*/ |
74 |
/* |
|
75 |
* Constructors |
/** |
76 |
*/ |
* This method initializes an instance of <code>FilterWriter</code> |
77 |
|
* to write to the specified subordinate <code>Writer</code>. |
78 |
/** |
* The given <code>Writer</code> will be used as <code>lock</code> for |
79 |
* This method initializes an instance of <code>FilterWriter</code> |
* the newly created <code>FilterWriter</code>. |
80 |
* to write to the specified subordinate <code>Writer</code>. |
* |
81 |
* The given <code>Writer</code> will be used as <code>lock</code> for |
* @param out The <code>Writer</code> to write to |
82 |
* the newly created <code>FilterWriter</code>. |
*/ |
83 |
* |
protected FilterWriter(Writer out) |
84 |
* @param out The <code>Writer</code> to write to |
{ |
85 |
*/ |
super(out); |
86 |
protected |
this.out = out; |
87 |
FilterWriter(Writer out) |
} |
88 |
{ |
|
89 |
super(out); |
/*************************************************************************/ |
90 |
this.out = out; |
|
91 |
} |
/* |
92 |
|
* Instance Methods |
93 |
/*************************************************************************/ |
*/ |
94 |
|
|
95 |
/* |
/** |
96 |
* Instance Methods |
* This method closes the underlying <code>Writer</code>. Any |
97 |
*/ |
* further attempts to write to this stream may throw an exception. |
98 |
|
* |
99 |
/** |
* @exception IOException If an error occurs |
100 |
* This method closes the underlying <code>Writer</code>. Any |
*/ |
101 |
* further attempts to write to this stream may throw an exception. |
public void close() throws IOException |
102 |
* |
{ |
103 |
* @exception IOException If an error occurs |
out.close(); |
104 |
*/ |
} |
105 |
public void |
|
106 |
close() throws IOException |
/*************************************************************************/ |
107 |
{ |
|
108 |
out.close(); |
/** |
109 |
} |
* This method attempt to flush all buffered output to be written to the |
110 |
|
* underlying output sink. |
111 |
/*************************************************************************/ |
* |
112 |
|
* @exception IOException If an error occurs |
113 |
/** |
*/ |
114 |
* This method attempt to flush all buffered output to be written to the |
public void flush() throws IOException |
115 |
* underlying output sink. |
{ |
116 |
* |
out.flush(); |
117 |
* @exception IOException If an error occurs |
} |
118 |
*/ |
|
119 |
public void |
/*************************************************************************/ |
120 |
flush() throws IOException |
|
121 |
{ |
/** |
122 |
out.flush(); |
* This method writes a single char of output to the underlying |
123 |
} |
* <code>Writer</code>. |
124 |
|
* |
125 |
/*************************************************************************/ |
* @param b The char to write, passed as an int. |
126 |
|
* |
127 |
/** |
* @exception IOException If an error occurs |
128 |
* This method writes a single char of output to the underlying |
*/ |
129 |
* <code>Writer</code>. |
public void write(int b) throws IOException |
130 |
* |
{ |
131 |
* @param b The char to write, passed as an int. |
out.write(b); |
132 |
* |
} |
133 |
* @exception IOException If an error occurs |
|
134 |
*/ |
/*************************************************************************/ |
135 |
public void |
|
136 |
write(int b) throws IOException |
/** |
137 |
{ |
* This method writes <code>len</code> chars from the array <code>buf</code> |
138 |
out.write(b); |
* starting at index <code>offset</code> to the underlying |
139 |
} |
* <code>Writer</code>. |
140 |
|
* |
141 |
/*************************************************************************/ |
* @param buf The char array to write chars from |
142 |
|
* @param offset The index into the array to start writing chars from |
143 |
/** |
* @param len The number of chars to write |
144 |
* This method writes <code>len</code> chars from the array <code>buf</code> |
* |
145 |
* starting at index <code>offset</code> to the underlying |
* @exception IOException If an error occurs |
146 |
* <code>Writer</code>. |
*/ |
147 |
* |
public void write(char[] buf, int offset, int len) throws IOException |
148 |
* @param buf The char array to write chars from |
{ |
149 |
* @param offset The index into the array to start writing chars from |
out.write(buf, offset, len); |
150 |
* @param len The number of chars to write |
} |
151 |
* |
|
152 |
* @exception IOException If an error occurs |
/*************************************************************************/ |
153 |
*/ |
|
154 |
public void |
/** |
155 |
write(char[] buf, int offset, int len) throws IOException |
* This method writes <code>len</code> chars from the <code>String</code> |
156 |
{ |
* starting at position <code>offset</code>. |
157 |
out.write(buf, offset, len); |
* |
158 |
} |
* @param str The <code>String</code> that is to be written |
159 |
|
* @param offset The character offset into the <code>String</code> |
160 |
/*************************************************************************/ |
* to start writing from |
161 |
|
* @param len The number of chars to write |
162 |
/** |
* |
163 |
* This method writes <code>len</code> chars from the <code>String</code> |
* @exception IOException If an error occurs |
164 |
* starting at position <code>offset</code>. |
*/ |
165 |
* |
public void write(String str, int offset, int len) throws IOException |
166 |
* @param str The <code>String</code> that is to be written |
{ |
167 |
* @param offset The character offset into the <code>String</code> to start writing from |
out.write(str, offset, len); |
168 |
* @param len The number of chars to write |
} |
|
* |
|
|
* @exception IOException If an error occurs |
|
|
*/ |
|
|
public void |
|
|
write(String str, int offset, int len) throws IOException |
|
|
{ |
|
|
out.write(str, offset, len); |
|
|
} |
|
169 |
|
|
170 |
} // class FilterWriter |
} // class FilterWriter |
171 |
|
|