@Override public void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override protected void finalize() throws Throwable { super.finalize(); close(); }
/** * Creates a PipedOutputStream with a default buffer size and connects it to * <code>sink</code>. * @exception IOException It was already connected. */ public FastPipedOutputStream(FastPipedInputStream sink) throws IOException { connect(sink); }
WindowsProcess(WinRMClient client, String command) throws IOException { this.client = client; this.command = command; toCallersStdin = new FastPipedInputStream(); callersStdin = new FastPipedOutputStream(toCallersStdin); callersStdout = new FastPipedInputStream(); toCallersStdout = new FastPipedOutputStream(callersStdout); callersStderr = new FastPipedInputStream(); toCallersStderr = new FastPipedOutputStream(callersStderr); startStdoutCopyThread(); try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } startStdinCopyThread(); }
/** * This tests the behaviour of the diagnosis blocking on a non-completed stream, as the writer end is kept open. */ @Test(timeout=3000) public void blockingStreamShouldNotPreventDiagnosis() throws Exception { FastPipedInputStream in = new FastPipedInputStream(); FastPipedOutputStream out = new FastPipedOutputStream(in); out.write(payload); ClassicCommandTransport ct = (ClassicCommandTransport) new ChannelBuilder("dummy",null) .withMode(Mode.BINARY) .withBaseLoader(getClass().getClassLoader()) .negotiate(in, new NullOutputStream()); verify(ct); } }
@Override public void flush() throws IOException { FastPipedInputStream s = sink(); synchronized(s.buffer) { // Release all readers. s.buffer.notifyAll(); } }
private void writeObject(ObjectOutputStream oos) throws IOException { if (in != null && out == null) { // remote will write to local FastPipedOutputStream pos = new FastPipedOutputStream((FastPipedInputStream) in); int oid = Channel.current() .export(pos, false); // this export is unexported in ProxyOutputStream.finalize() oos.writeBoolean(true); // marker oos.writeInt(oid); } else { // remote will read from local int oid = Channel.current().export(out); oos.writeBoolean(false); oos.writeInt(oid); } }
@Override public void flush() throws IOException { FastPipedInputStream s = sink(); synchronized(s.buffer) { // Release all readers. s.buffer.notifyAll(); } }
private void writeObject(ObjectOutputStream oos) throws IOException { if (in != null && out == null) { // remote will write to local FastPipedOutputStream pos = new FastPipedOutputStream((FastPipedInputStream) in); int oid = Channel.current() .export(pos, false); // this export is unexported in ProxyOutputStream.finalize() oos.writeBoolean(true); // marker oos.writeInt(oid); } else { // remote will read from local int oid = Channel.current().export(out); oos.writeBoolean(false); oos.writeInt(oid); } }
@Override public void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public void flush() throws IOException { FastPipedInputStream s = sink(); synchronized(s.buffer) { // Release all readers. s.buffer.notifyAll(); } }
/** * Creates a PipedOutputStream with a default buffer size and connects it to * <code>sink</code>. * @exception IOException It was already connected. */ public FastPipedOutputStream(FastPipedInputStream sink) throws IOException { connect(sink); }
@Override protected void finalize() throws Throwable { super.finalize(); close(); }
private void writeObject(ObjectOutputStream oos) throws IOException { if (in != null && out == null) { // remote will write to local FastPipedOutputStream pos = new FastPipedOutputStream((FastPipedInputStream) in); int oid = Channel.current() .export(pos, false); // this export is unexported in ProxyOutputStream.finalize() oos.writeBoolean(true); // marker oos.writeInt(oid); } else { // remote will read from local int oid = Channel.current().export(out); oos.writeBoolean(false); oos.writeInt(oid); } }
@Override public void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public void flush() throws IOException { FastPipedInputStream s = sink(); synchronized(s.buffer) { // Release all readers. s.buffer.notifyAll(); } }