Java Code Examples for org.apache.sshd.common.io.IoOutputStream#write()

The following examples show how to use org.apache.sshd.common.io.IoOutputStream#write() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TtyCommand.java    From aesh-readline with Apache License 2.0 6 votes vote down vote up
@Override
public void setIoOutputStream(IoOutputStream out) {
    this.ioOut = out;
    this.out = (byte[] bytes) -> {
        if(writeFuture == null)
            writeFuture = out.write(new ByteArrayBuffer(bytes));
        else if(writeFuture.isWritten())
            writeFuture = out.write(new ByteArrayBuffer(bytes));
        else {
            try {
                writeFuture.await();
                writeFuture = out.write(new ByteArrayBuffer(bytes));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    };
}
 
Example 2
Source File: TtyCommand.java    From termd with Apache License 2.0 5 votes vote down vote up
@Override
public void setIoOutputStream(final IoOutputStream out) {
  this.ioOut = out;
  this.out = new Consumer<byte[]>() {
    @Override
    public void accept(byte[] bytes) {
      out.write(new ByteArrayBuffer(bytes));
    }
  };
}
 
Example 3
Source File: TtyCommand.java    From termd with Apache License 2.0 4 votes vote down vote up
@Override
public void setIoOutputStream(IoOutputStream out) {
  this.ioOut = out;
  this.out = bytes -> out.write(new ByteArrayBuffer(bytes));
}