/* * Closes this stream. If this stream is connected to an input stream, the * input stream is closed and the pipe is disconnected. * * @throws IOException * if an error occurs while closing this stream. */ public override void close() {//throws IOException { // Is the pipe connected? if (dest != null) { dest.done(); dest = null; } }
/* * Connects this stream to a {@link PipedInputStream}. Any data written to * this output stream becomes readable in the input stream. * * @param stream * the destination input stream. * @throws IOException * if either stream is already connected. */ public void connect(PipedInputStream stream) {//throws IOException { if (null == stream) { throw new java.lang.NullPointerException(); } if (this.dest != null) { throw new IOException("Already connected"); //$NON-NLS-1$ } lock (stream) { if (stream.isConnected) { throw new IOException("Pipe already connected"); //$NON-NLS-1$ } if (stream.buffer == null) { stream.buffer = new byte[PipedInputStream.PIPE_SIZE]; } stream.isConnected = true; this.dest = stream; } }
/* * Constructs a new {@code PipedOutputStream} connected to the * {@link PipedInputStream} {@code dest}. Any data written to this stream * can be read from the target stream. * * @param dest * the piped input stream to connect to. * @throws IOException * if this stream or {@code dest} are already connected. */ public PipedOutputStream(PipedInputStream dest) :// throws IOException { base() { connect(dest); }
/** * Closes this stream. If this stream is connected to an input stream, the * input stream is closed and the pipe is disconnected. * * @throws IOException * if an error occurs while closing this stream. */ public override void close() { //throws IOException { // Is the pipe connected? if (dest != null) { dest.done(); dest = null; } }
// throws IOException { /** * Constructs a new {@code PipedOutputStream} connected to the * {@link PipedInputStream} {@code dest}. Any data written to this stream * can be read from the target stream. * * @param dest * the piped input stream to connect to. * @throws IOException * if this stream or {@code dest} are already connected. */ public PipedOutputStream(PipedInputStream dest) : base() { connect(dest); }
/** * Connects this stream to a {@link PipedInputStream}. Any data written to * this output stream becomes readable in the input stream. * * @param stream * the destination input stream. * @throws IOException * if either stream is already connected. */ public void connect(PipedInputStream stream) { //throws IOException { if (null == stream) { throw new java.lang.NullPointerException(); } if (this.dest != null) { throw new IOException("Already connected"); //$NON-NLS-1$ } lock (stream) { if (stream.isConnected) { throw new IOException("Pipe already connected"); //$NON-NLS-1$ } if (stream.buffer == null) { stream.buffer = new byte[PipedInputStream.PIPE_SIZE]; } stream.isConnected = true; this.dest = stream; } }