Java Reference
In-Depth Information
public class SpiderInputStream extends InputStream {
/**
* The InputStream to read from.
*/
private InputStream is;
/**
* The OutputStream to write to.
*/
private OutputStream os;
/**
* Construct the SpiderInputStream. Whatever is read from
* the InputStream will also be written to the
* OutputStream.
*
* @param is
* The InputStream.
* @param os
* The OutputStream.
*/
public SpiderInputStream(InputStream is, OutputStream os) {
this.is = is;
this.os = os;
}
/*
* Read a single byte from the stream. @throws IOException
* If an I/O exception occurs. @return The character that
* was read from the stream.
*/
@Override
public int read() throws IOException {
int ch = this.is.read();
if (this.os != null) {
this.os.write(ch);
}
return ch;
}
Search WWH ::




Custom Search