/** * Creates a {@link Pipe} that allows remote system to write and local system to read. */ public static Pipe createRemoteToLocal() { // OutputStream will be created on the target return new Pipe(new FastPipedInputStream(), null); }
@Override public int read(byte[] b) throws IOException { return read(b, 0, b.length); }
@Override protected void finalize() throws Throwable { super.finalize(); close(); }
/** * Creates a PipedInputStream with buffer size <code>bufferSize</code> and * connects it to <code>source</code>. * @exception IOException It was already connected. */ public FastPipedInputStream(FastPipedOutputStream source, int bufferSize) throws IOException { if(source != null) { connect(source); } this.buffer = new byte[bufferSize]; }
return -1; source(); // make sure the sink is still trying to read, or else fail the write.
/** * Creates a PipedInputStream with buffer size <code>bufferSize</code> and * connects it to <code>source</code>. * @exception IOException It was already connected. */ public FastPipedInputStream(FastPipedOutputStream source, int bufferSize) throws IOException { if(source != null) { connect(source); } this.buffer = new byte[bufferSize]; }
return -1; source(); // make sure the sink is still trying to read, or else fail the write.
/** * Creates a {@link Pipe} that allows remote system to write and local system to read. */ public static Pipe createRemoteToLocal() { // OutputStream will be created on the target return new Pipe(new FastPipedInputStream(), null); }
@Override public int read(byte[] b) throws IOException { return read(b, 0, b.length); }
@Override protected void finalize() throws Throwable { super.finalize(); close(); }
/** * Creates a PipedInputStream with buffer size <code>bufferSize</code> and * connects it to <code>source</code>. * @exception IOException It was already connected. */ public FastPipedInputStream(FastPipedOutputStream source, int bufferSize) throws IOException { if(source != null) { connect(source); } this.buffer = new byte[bufferSize]; }
return -1; source(); // make sure the sink is still trying to read, or else fail the write.
/** * Creates a {@link Pipe} that allows remote system to write and local system to read. */ public static Pipe createRemoteToLocal() { // OutputStream will be created on the target return new Pipe(new FastPipedInputStream(),null); }
@Override public int read(byte[] b) throws IOException { return read(b, 0, b.length); }
@Override protected void finalize() throws Throwable { super.finalize(); close(); }
/** * Creates a PipedInputStream with buffer size <code>bufferSize</code> and * connects it to <code>source</code>. * @exception IOException It was already connected. */ public FastPipedInputStream(FastPipedOutputStream source, int bufferSize) throws IOException { if(source != null) { connect(source); } this.buffer = new byte[bufferSize]; }
throw new IOException(c); source(); // make sure the sink is still trying to read, or else fail the write.
/** * Creates a {@link Pipe} that allows remote system to write and local system to read. */ public static Pipe createRemoteToLocal() { // OutputStream will be created on the target return new Pipe(new FastPipedInputStream(), null); }
public int read() throws IOException { byte[] b = new byte[1]; return read(b, 0, b.length) == -1 ? -1 : (255 & b[0]); }
@Override protected void finalize() throws Throwable { super.finalize(); close(); }