home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 January / PCO0198.ISO / 1&1 / java.z / java_301 / java / io / PipedOutputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-10-20  |  1.1 KB  |  35 lines

  1. package java.io;
  2.  
  3. public class PipedOutputStream extends OutputStream {
  4.    private PipedInputStream sink;
  5.  
  6.    public PipedOutputStream(PipedInputStream snk) throws IOException {
  7.       this.connect(snk);
  8.    }
  9.  
  10.    public PipedOutputStream() {
  11.    }
  12.  
  13.    public void connect(PipedInputStream snk) throws IOException {
  14.       this.sink = snk;
  15.       snk.closed = false;
  16.       snk.in = -1;
  17.       snk.out = 0;
  18.    }
  19.  
  20.    public void write(int b) throws IOException {
  21.       this.sink.receive(b);
  22.    }
  23.  
  24.    public void write(byte[] b, int off, int len) throws IOException {
  25.       this.sink.receive(b, off, len);
  26.    }
  27.  
  28.    public void close() throws IOException {
  29.       if (this.sink != null) {
  30.          this.sink.receivedLast();
  31.       }
  32.  
  33.    }
  34. }
  35.