Class ChannelOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- net.schmizz.sshj.connection.channel.ChannelOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
,ErrorNotifiable
public final class ChannelOutputStream extends java.io.OutputStream implements ErrorNotifiable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
ChannelOutputStream.DataBuffer
-
Nested classes/interfaces inherited from interface net.schmizz.sshj.common.ErrorNotifiable
ErrorNotifiable.Util
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]
b
private ChannelOutputStream.DataBuffer
buffer
private AbstractChannel
chan
private java.util.concurrent.atomic.AtomicBoolean
closed
private SSHException
error
private Transport
trans
private Window.Remote
win
-
Constructor Summary
Constructors Constructor Description ChannelOutputStream(AbstractChannel chan, Transport trans, Window.Remote win)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkClose()
void
close()
void
flush()
Send all data currently buffered.void
notifyError(SSHException error)
Notifies this object of anerror
.private static void
throwStreamClosed()
java.lang.String
toString()
void
write(byte[] data, int off, int len)
void
write(int w)
-
-
-
Field Detail
-
chan
private final AbstractChannel chan
-
trans
private final Transport trans
-
win
private final Window.Remote win
-
buffer
private final ChannelOutputStream.DataBuffer buffer
-
b
private final byte[] b
-
closed
private java.util.concurrent.atomic.AtomicBoolean closed
-
error
private SSHException error
-
-
Constructor Detail
-
ChannelOutputStream
public ChannelOutputStream(AbstractChannel chan, Transport trans, Window.Remote win)
-
-
Method Detail
-
write
public void write(int w) throws java.io.IOException
- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] data, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
notifyError
public void notifyError(SSHException error)
Description copied from interface:ErrorNotifiable
Notifies this object of anerror
.- Specified by:
notifyError
in interfaceErrorNotifiable
-
checkClose
private void checkClose() throws SSHException
- Throws:
SSHException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
Send all data currently buffered. If window space is exhausted in the process, this will block until it is expanded by the server.- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
throwStreamClosed
private static void throwStreamClosed() throws ConnectionException
- Throws:
ConnectionException
-
-