home *** CD-ROM | disk | FTP | other *** search
- package java.io;
-
- public class PipedOutputStream extends OutputStream {
- private PipedInputStream sink;
- boolean connected = false;
-
- public PipedOutputStream(PipedInputStream var1) throws IOException {
- this.connect(var1);
- }
-
- public PipedOutputStream() {
- }
-
- public void connect(PipedInputStream var1) throws IOException {
- if (!this.connected && !var1.connected) {
- this.sink = var1;
- var1.closed = false;
- var1.in = -1;
- var1.out = 0;
- this.connected = true;
- } else {
- throw new IOException("Already connected");
- }
- }
-
- public void write(int var1) throws IOException {
- this.sink.receive(var1);
- }
-
- public void write(byte[] var1, int var2, int var3) throws IOException {
- this.sink.receive(var1, var2, var3);
- }
-
- public synchronized void flush() throws IOException {
- if (this.sink != null) {
- PipedInputStream var1 = this.sink;
- synchronized(var1){}
-
- try {
- this.sink.notifyAll();
- } catch (Throwable var3) {
- throw var3;
- }
-
- }
- }
-
- public void close() throws IOException {
- if (this.sink != null) {
- this.sink.receivedLast();
- }
-
- }
- }
-