public class DefaultSftpClient extends AbstractSftpClient
SftpClient.Attribute, SftpClient.Attributes, SftpClient.CloseableHandle, SftpClient.CopyMode, SftpClient.DirEntry, SftpClient.Handle, SftpClient.OpenMode| Modifier and Type | Field and Description |
|---|---|
private ChannelSubsystem |
channel |
private ClientSession |
clientSession |
private java.util.concurrent.atomic.AtomicBoolean |
closing |
private java.util.concurrent.atomic.AtomicInteger |
cmdId |
private java.util.NavigableMap<java.lang.String,byte[]> |
exposedExtensions |
private java.util.NavigableMap<java.lang.String,byte[]> |
extensions |
private java.util.Map<java.lang.Integer,Buffer> |
messages |
private java.nio.charset.Charset |
nameDecodingCharset |
private Buffer |
receiveBuffer |
private java.util.concurrent.atomic.AtomicInteger |
versionHolder |
private byte[] |
workBuf |
DEFAULT_WRITE_CHUNK_SIZE, WRITE_CHUNK_SIZElogDEFAULT_CHANNEL_MODES, DEFAULT_CHANNEL_OPEN_TIMEOUT, DEFAULT_NAME_DECODING_CHARSET, DEFAULT_READ_BUFFER_SIZE, DEFAULT_WAIT_TIMEOUT, DEFAULT_WRITE_BUFFER_SIZE, EMPTY_DIR_ENTRIES, IO_BUFFER_SIZE, MIN_BUFFER_SIZE, MIN_READ_BUFFER_SIZE, MIN_WRITE_BUFFER_SIZE, NAME_DECODING_CHARSET, SFTP_CHANNEL_OPEN_TIMEOUTBY_NAME_COMPARATOR, NAME_EXTRACTOR| Constructor and Description |
|---|
DefaultSftpClient(ClientSession clientSession) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected int |
data(byte[] buf,
int start,
int len)
Receive binary data
|
ClientChannel |
getClientChannel() |
ClientSession |
getClientSession() |
java.nio.charset.Charset |
getNameDecodingCharset() |
java.util.NavigableMap<java.lang.String,byte[]> |
getServerExtensions() |
int |
getVersion() |
protected void |
init(long initializationTimeout) |
boolean |
isClosing() |
boolean |
isOpen() |
int |
negotiateVersion(SftpVersionSelector selector) |
protected void |
process(Buffer incoming)
Process an SFTP packet
|
protected Buffer |
read() |
protected boolean |
receive(Buffer incoming)
Read SFTP packets from buffer
|
Buffer |
receive(int id) |
int |
send(int cmd,
Buffer buffer) |
void |
setNameDecodingCharset(java.nio.charset.Charset nameDecodingCharset) |
canonicalPath, checkAttributes, checkAttributesResponse, checkCommandStatus, checkData, checkDataResponse, checkDirResponse, checkHandle, checkHandleResponse, checkOneName, checkOneNameResponse, checkResponseStatus, checkResponseStatus, close, getChannel, getExtension, getExtension, getExtension, getParsedServerExtensions, getParsedServerExtensions, getReferencedName, handleUnexpectedAttributesPacket, handleUnexpectedHandlePacket, handleUnexpectedPacket, handleUnknownDataPacket, handleUnknownDirListingPacket, handleUnknownOneNamePacket, link, lock, lstat, mkdir, open, openDir, putReferencedName, read, readAttributes, readDir, readLink, remove, rename, rmdir, setStat, setStat, stat, stat, throwStatusException, unlock, validateIncomingResponse, write, writeAttributesgetSession, toStringgetSimplifiedLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetName, listDir, open, open, openRemoteFileChannel, openRemoteFileChannel, openRemotePathChannel, openRemotePathChannel, read, read, read, read, read, read, read, read, read, readDir, readDir, rename, rename, symLink, write, write, write, write, write, write, writegetSessionfindByName, getNameList, getNames, ofName, removeByNameprivate final ClientSession clientSession
private final ChannelSubsystem channel
private final java.util.Map<java.lang.Integer,Buffer> messages
private final java.util.concurrent.atomic.AtomicInteger cmdId
private final Buffer receiveBuffer
private final byte[] workBuf
private final java.util.concurrent.atomic.AtomicInteger versionHolder
private final java.util.concurrent.atomic.AtomicBoolean closing
private final java.util.NavigableMap<java.lang.String,byte[]> extensions
private final java.util.NavigableMap<java.lang.String,byte[]> exposedExtensions
private java.nio.charset.Charset nameDecodingCharset
public DefaultSftpClient(ClientSession clientSession) throws java.io.IOException
java.io.IOExceptionpublic int getVersion()
public ClientSession getClientSession()
ClientSession usedpublic ClientChannel getClientChannel()
ClientChannel usedpublic java.util.NavigableMap<java.lang.String,byte[]> getServerExtensions()
NavigableMap of the reported server extensions.
where key=extension name (case insensitive)public java.nio.charset.Charset getNameDecodingCharset()
null) Charset used to decode referenced files/folders namesSftpClient.NAME_DECODING_CHARSETpublic void setNameDecodingCharset(java.nio.charset.Charset nameDecodingCharset)
public boolean isClosing()
public boolean isOpen()
public void close()
throws java.io.IOException
java.io.IOExceptionprotected int data(byte[] buf,
int start,
int len)
throws java.io.IOException
buf - The buffer for the incoming datastart - Offset in buffer to place the datalen - Available space in buffer for the datajava.io.IOException - If failed to receive incoming dataprotected boolean receive(Buffer incoming) throws java.io.IOException
incoming - The received Buffertrue if data from incoming buffer was processedjava.io.IOException - if failed to process the bufferprocess(Buffer)protected void process(Buffer incoming) throws java.io.IOException
incoming - The received Bufferjava.io.IOException - if failed to process the bufferpublic int send(int cmd,
Buffer buffer)
throws java.io.IOException
cmd - Command to send - Note: only lower 8-bits are usedbuffer - The Buffer containing the command datajava.io.IOException - if failed to send commandpublic Buffer receive(int id) throws java.io.IOException
id - The expected request idBuffer containing the request idjava.io.IOException - If connection closed or interruptedprotected Buffer read() throws java.io.IOException
java.io.IOExceptionprotected void init(long initializationTimeout)
throws java.io.IOException
java.io.IOExceptionpublic int negotiateVersion(SftpVersionSelector selector) throws java.io.IOException
selector - The SftpVersionSelector to use - ignored if nulljava.io.IOException - If failed to negotiate