70 |
public class FilterInputStream extends InputStream |
public class FilterInputStream extends InputStream |
71 |
{ |
{ |
72 |
|
|
73 |
/*************************************************************************/ |
/*************************************************************************/ |
74 |
|
|
75 |
/* |
/* |
76 |
* Instance Variables |
* Instance Variables |
77 |
*/ |
*/ |
78 |
|
|
79 |
/** |
/** |
80 |
* This is the subordinate <code>InputStream</code> to which method calls |
* This is the subordinate <code>InputStream</code> to which method calls |
81 |
* are redirected |
* are redirected |
82 |
*/ |
*/ |
83 |
protected InputStream in; |
protected InputStream in; |
84 |
|
|
85 |
/*************************************************************************/ |
/*************************************************************************/ |
86 |
|
|
87 |
/* |
/* |
88 |
* Constructors |
* Constructors |
89 |
*/ |
*/ |
90 |
|
|
91 |
/** |
/** |
92 |
* Create a <code>FilterInputStream</code> with the specified subordinate |
* Create a <code>FilterInputStream</code> with the specified subordinate |
93 |
* <code>InputStream</code>. |
* <code>InputStream</code>. |
94 |
* |
* |
95 |
* @param in The subordinate <code>InputStream</code> |
* @param in The subordinate <code>InputStream</code> |
96 |
*/ |
*/ |
97 |
protected |
protected FilterInputStream(InputStream in) |
98 |
FilterInputStream(InputStream in) |
{ |
99 |
{ |
this.in = in; |
100 |
this.in = in; |
} |
101 |
} |
|
102 |
|
/*************************************************************************/ |
103 |
/*************************************************************************/ |
|
104 |
|
/* |
105 |
/* |
* Instance Methods |
106 |
* Instance Methods |
*/ |
107 |
*/ |
|
108 |
|
/** |
109 |
/** |
* Calls the <code>in.mark(int)</code> method. |
110 |
* Calls the <code>in.mark(int)</code> method. |
* |
111 |
* |
* @param readlimit The parameter passed to <code>in.mark(int)</code> |
112 |
* @param readlimit The parameter passed to <code>in.mark(int)</code> |
*/ |
113 |
*/ |
public void mark(int readlimit) |
114 |
public void |
{ |
115 |
mark(int readlimit) |
in.mark(readlimit); |
116 |
{ |
} |
117 |
in.mark(readlimit); |
|
118 |
} |
/*************************************************************************/ |
119 |
|
|
120 |
/*************************************************************************/ |
/** |
121 |
|
* Calls the <code>in.markSupported()</code> method. |
122 |
/** |
* |
123 |
* Calls the <code>in.markSupported()</code> method. |
* @return <code>true</code> if mark/reset is supported, <code>false</code> |
124 |
* |
* otherwise |
125 |
* @return <code>true</code> if mark/reset is supported, <code>false</code> |
*/ |
126 |
* otherwise |
public boolean markSupported() |
127 |
*/ |
{ |
128 |
public boolean |
return(in.markSupported()); |
129 |
markSupported() |
} |
130 |
{ |
|
131 |
return(in.markSupported()); |
/*************************************************************************/ |
132 |
} |
|
133 |
|
/** |
134 |
/*************************************************************************/ |
* Calls the <code>in.reset()</code> method. |
135 |
|
* |
136 |
/** |
* @exception IOException If an error occurs |
137 |
* Calls the <code>in.reset()</code> method. |
*/ |
138 |
* |
public void reset() throws IOException |
139 |
* @exception IOException If an error occurs |
{ |
140 |
*/ |
in.reset(); |
141 |
public void |
} |
142 |
reset() throws IOException |
|
143 |
{ |
/*************************************************************************/ |
144 |
in.reset(); |
|
145 |
} |
/** |
146 |
|
* Calls the <code>in.available()</code> method. |
147 |
/*************************************************************************/ |
* |
148 |
|
* @return The value returned from <code>in.available()</code> |
149 |
/** |
* |
150 |
* Calls the <code>in.available()</code> method. |
* @exception IOException If an error occurs |
151 |
* |
*/ |
152 |
* @return The value returned from <code>in.available()</code> |
public int available() throws IOException |
153 |
* |
{ |
154 |
* @exception IOException If an error occurs |
return(in.available()); |
155 |
*/ |
} |
156 |
public int |
|
157 |
available() throws IOException |
/*************************************************************************/ |
158 |
{ |
|
159 |
return(in.available()); |
/** |
160 |
} |
* Calls the <code>in.skip(long)</code> method |
161 |
|
* |
162 |
/*************************************************************************/ |
* @param numBytes The requested number of bytes to skip. |
163 |
|
* |
164 |
/** |
* @return The value returned from <code>in.skip(long)</code> |
165 |
* Calls the <code>in.skip(long)</code> method |
* |
166 |
* |
* @exception IOException If an error occurs |
167 |
* @param The requested number of bytes to skip. |
*/ |
168 |
* |
public long skip(long num_bytes) throws IOException |
169 |
* @return The value returned from <code>in.skip(long)</code> |
{ |
170 |
* |
return(in.skip(num_bytes)); |
171 |
* @exception IOException If an error occurs |
} |
172 |
*/ |
|
173 |
public long |
/*************************************************************************/ |
174 |
skip(long num_bytes) throws IOException |
|
175 |
{ |
/** |
176 |
return(in.skip(num_bytes)); |
* Calls the <code>in.read()</code> method |
177 |
} |
* |
178 |
|
* @return The value returned from <code>in.read()</code> |
179 |
/*************************************************************************/ |
* |
180 |
|
* @exception IOException If an error occurs |
181 |
/** |
*/ |
182 |
* Calls the <code>in.read()</code> method |
public int read() throws IOException |
183 |
* |
{ |
184 |
* @return The value returned from <code>in.read()</code> |
return(in.read()); |
185 |
* |
} |
186 |
* @exception IOException If an error occurs |
|
187 |
*/ |
/*************************************************************************/ |
188 |
public int |
|
189 |
read() throws IOException |
/** |
190 |
{ |
* Calls the <code>read(byte[], int, int)</code> overloaded method. |
191 |
return(in.read()); |
* Note that |
192 |
} |
* this method does not redirect its call directly to a corresponding |
193 |
|
* method in <code>in</code>. This allows subclasses to override only the |
194 |
/*************************************************************************/ |
* three argument version of <code>read</code>. |
195 |
|
* |
196 |
/** |
* @param buf The buffer to read bytes into |
197 |
* Calls the <code>read(byte[], int, int)</code> overloaded method. Note that |
* |
198 |
* this method does not redirect its call directly to a corresponding |
* @return The value retured from <code>in.read(byte[], int, int)</code> |
199 |
* method in <code>in</code>. This allows subclasses to override only the |
* |
200 |
* three argument version of <code>read</code>. |
* @exception IOException If an error occurs |
201 |
* |
*/ |
202 |
* @param buf The buffer to read bytes into |
public int read(byte[] buf) throws IOException |
203 |
* |
{ |
204 |
* @return The value retured from <code>in.read(byte[], int, int)</code> |
return(read(buf, 0, buf.length)); |
205 |
* |
} |
206 |
* @exception IOException If an error occurs |
|
207 |
*/ |
/*************************************************************************/ |
208 |
public int |
|
209 |
read(byte[] buf) throws IOException |
/** |
210 |
{ |
* Calls the <code>in.read(byte[], int, int)</code> method. |
211 |
return(read(buf, 0, buf.length)); |
* |
212 |
} |
* @param buf The buffer to read bytes into |
213 |
|
* @param offset The index into the buffer to start storing bytes |
214 |
/*************************************************************************/ |
* @param len The maximum number of bytes to read. |
215 |
|
* |
216 |
/** |
* @return The value retured from <code>in.read(byte[], int, int)</code> |
217 |
* Calls the <code>in.read(byte[], int, int)</code> method. |
* |
218 |
* |
* @exception IOException If an error occurs |
219 |
* @param buf The buffer to read bytes into |
*/ |
220 |
* @param offset The index into the buffer to start storing bytes |
public int read(byte[] buf, int offset, int len) throws IOException |
221 |
* @param len The maximum number of bytes to read. |
{ |
222 |
* |
return(in.read(buf, offset, len)); |
223 |
* @return The value retured from <code>in.read(byte[], int, int)</code> |
} |
224 |
* |
|
225 |
* @exception IOException If an error occurs |
/*************************************************************************/ |
226 |
*/ |
|
227 |
public int |
/** |
228 |
read(byte[] buf, int offset, int len) throws IOException |
* This method closes the input stream by closing the input stream that |
229 |
{ |
* this object is filtering. Future attempts to access this stream may |
230 |
return(in.read(buf, offset, len)); |
* throw an exception. |
231 |
} |
* |
232 |
|
* @exception IOException If an error occurs |
233 |
/*************************************************************************/ |
*/ |
234 |
|
public void close() throws IOException |
235 |
/** |
{ |
236 |
* This method closes the input stream by closing the input stream that |
in.close(); |
237 |
* this object is filtering. Future attempts to access this stream may |
} |
|
* throw an exception. |
|
|
* |
|
|
* @exception IOException If an error occurs |
|
|
*/ |
|
|
public void |
|
|
close() throws IOException |
|
|
{ |
|
|
in.close(); |
|
|
} |
|
238 |
|
|
239 |
} // class FilterInputStream |
} // class FilterInputStream |
240 |
|
|