home *** CD-ROM | disk | FTP | other *** search
- package java.io;
-
- public class PipedOutputStream extends OutputStream {
- private PipedInputStream sink;
-
- public PipedOutputStream(PipedInputStream snk) throws IOException {
- this.connect(snk);
- }
-
- public PipedOutputStream() {
- }
-
- public void connect(PipedInputStream snk) throws IOException {
- this.sink = snk;
- snk.closed = false;
- snk.in = -1;
- snk.out = 0;
- }
-
- public void write(int b) throws IOException {
- this.sink.receive(b);
- }
-
- public void write(byte[] b, int off, int len) throws IOException {
- this.sink.receive(b, off, len);
- }
-
- public void close() throws IOException {
- if (this.sink != null) {
- this.sink.receivedLast();
- }
-
- }
- }
-