code: public void connect(PipedInputStream stream) throws IOException {
          if (stream == null) {
              throw new NullPointerException("stream == null");
          }
          synchronized (stream) {
              if (this.target != null) {
                  throw new IOException("Already connected");
              }
              if (stream.isConnected) {
                  throw new IOException("Pipe already connected");
              }
              stream.establishConnection();
              this.target = stream;
          }
      }
docs: Connects this stream to a {@link PipedInputStream}. Any data written to
  this output stream becomes readable in the input stream.
  
  @param stream
  the piped input stream to connect to.
  @throws IOException
  if either stream is already connected.