@Override public synchronized void close() throws IOException { if (!isOpen()) { return; } if (log.isTraceEnabled()) { log.trace("close({}) closing", this); } try { flush(); if (isEofOnClose()) { AbstractChannel channel = getChannel(); channel.sendEof(); } } finally { try { if (!(packetWriter instanceof Channel)) { packetWriter.close(); } } finally { closedState.set(true); } } }
@Override public synchronized void close() throws IOException { if (!isOpen()) { return; } if (log.isTraceEnabled()) { log.trace("close({}) closing", this); } try { flush(); if (isEofOnClose()) { AbstractChannel channel = getChannel(); channel.sendEof(); } } finally { try { if (!(packetWriter instanceof Channel)) { packetWriter.close(); } } finally { closedState.set(true); } } }
@Override public synchronized void write(byte[] buf, int s, int l) throws IOException { Channel channel = getChannel(); if (!isOpen()) { throw new SshChannelClosedException(channel.getId(), "write(" + this + ") len=" + l + " - channel already closed");
@Override public synchronized void write(byte[] buf, int s, int l) throws IOException { Channel channel = getChannel(); if (!isOpen()) { throw new SshChannelClosedException(channel.getId(), "write(" + this + ") len=" + l + " - channel already closed");
@Override public synchronized void flush() throws IOException { AbstractChannel channel = getChannel(); if (!isOpen()) { throw new SshChannelClosedException(channel.getId(), "flush(" + this + ") length=" + bufferLength + " - stream is already closed");
@Override public synchronized void flush() throws IOException { AbstractChannel channel = getChannel(); if (!isOpen()) { throw new SshChannelClosedException(channel.getId(), "flush(" + this + ") length=" + bufferLength + " - stream is already closed");