Package org.apache.sshd.sftp.client.impl
Class SftpOutputStreamAsync
java.lang.Object
java.io.OutputStream
org.apache.sshd.common.util.io.output.OutputStreamWithChannel
org.apache.sshd.sftp.client.impl.SftpOutputStreamAsync
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,Channel,SftpClientHolder
public class SftpOutputStreamAsync
extends org.apache.sshd.common.util.io.output.OutputStreamWithChannel
implements SftpClientHolder
Implements an output stream for a given remote file
- Author:
- Apache MINA SSHD Project
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final byte[]protected org.apache.sshd.common.util.buffer.Bufferprotected final intprotected SftpClient.CloseableHandleprotected final org.slf4j.Loggerprotected longprotected final Deque<SftpAckData> -
Constructor Summary
ConstructorsConstructorDescriptionSftpOutputStreamAsync(AbstractSftpClient client, int bufferSize, String path, Collection<SftpClient.OpenMode> mode) Creates a new stream to write data to a remote file.SftpOutputStreamAsync(AbstractSftpClient client, int bufferSize, String path, SftpClient.CloseableHandle handle) Creates a new stream to write data to a remote file.SftpOutputStreamAsync(AbstractSftpClient client, int bufferSize, String path, SftpClient.CloseableHandle handle, boolean closeHandle) Creates a new stream to write data to a remote file. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()final AbstractSftpClientfinal StringgetPath()The remotely accessed file pathbooleanisOpen()voidsetOffset(long offset) toString()longtransferFrom(InputStream stream) longtransferFrom(ReadableByteChannel stream, long count) voidwrite(byte[] b, int off, int len) voidwrite(int b) Methods inherited from class java.io.OutputStream
write
-
Field Details
-
log
protected final org.slf4j.Logger log -
bb
protected final byte[] bb -
bufferSize
protected final int bufferSize -
buffer
protected org.apache.sshd.common.util.buffer.Buffer buffer -
handle
-
offset
protected long offset -
pendingAcks
-
-
Constructor Details
-
SftpOutputStreamAsync
public SftpOutputStreamAsync(AbstractSftpClient client, int bufferSize, String path, Collection<SftpClient.OpenMode> mode) throws IOException Creates a new stream to write data to a remote file.- Parameters:
client-AbstractSftpClientto use for writing databufferSize- SFTP packet length to use. Most servers have a limit of 256kB. If zero, the stream picks a size such that each SFTP packet fits into a single SSH packet, i.e., roughly 32kB.path- remote path to write tomode-SftpClient.OpenModes for opening the file.- Throws:
IOException- if the remote file cannot be opened
-
SftpOutputStreamAsync
public SftpOutputStreamAsync(AbstractSftpClient client, int bufferSize, String path, SftpClient.CloseableHandle handle) Creates a new stream to write data to a remote file.- Parameters:
client-AbstractSftpClientto use for writing databufferSize- SFTP packet length to use. Most servers have a limit of 256kB. If zero, the stream picks a size such that each SFTP packet fits into a single SSH packet, i.e., roughly 32kB.handle-SftpClient.CloseableHandleof the remote file to write to; will be closed when this output stream is closed
-
SftpOutputStreamAsync
public SftpOutputStreamAsync(AbstractSftpClient client, int bufferSize, String path, SftpClient.CloseableHandle handle, boolean closeHandle) Creates a new stream to write data to a remote file.- Parameters:
client-AbstractSftpClientto use for writing databufferSize- SFTP packet length to use. Most servers have a limit of 256kB. If zero, the stream picks a size such that each SFTP packet fits into a single SSH packet, i.e., roughly 32kB.handle-SftpClient.CloseableHandleof the remote file to write tocloseHandle- whether to close thehandlewhen this output stream is closed
-
-
Method Details
-
getClient
- Specified by:
getClientin interfaceSftpClientHolder
-
setOffset
public void setOffset(long offset) -
getPath
The remotely accessed file path- Returns:
- Remote file path
-
isOpen
public boolean isOpen() -
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
transferFrom
- Throws:
IOException
-
transferFrom
- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
toString
-