Class AbstractSftpClientExtension
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.sftp.client.extensions.helpers.AbstractSftpClientExtension
- All Implemented Interfaces:
NamedResource,OptionalFeature,SftpClientExtension,RawSftpClient,SftpClientHolder
- Direct Known Subclasses:
AbstractCheckFileExtension,AbstractMD5HashExtension,AbstractOpenSSHStatCommandExtension,CopyDataExtensionImpl,CopyFileExtensionImpl,FilenameTranslationControlExtensionImpl,OpenSSHFsyncExtensionImpl,OpenSSHLimitsExtensionImpl,OpenSSHPosixRenameExtensionImpl,SpaceAvailableExtensionImpl
public abstract class AbstractSftpClientExtension
extends org.apache.sshd.common.util.logging.AbstractLoggingBean
implements SftpClientExtension, RawSftpClient
- Author:
- Apache MINA SSHD Project
-
Field Summary
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
logFields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTORFields inherited from interface org.apache.sshd.common.OptionalFeature
FALSE, TRUE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, boolean supported) protectedAbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, Collection<String> extras) protectedAbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, Map<String, byte[]> extensions) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.sshd.common.util.buffer.BuffercheckExtendedReplyBuffer(org.apache.sshd.common.util.buffer.Buffer buffer) protected voidcheckStatus(org.apache.sshd.common.util.buffer.Buffer buffer) final SftpClientprotected org.apache.sshd.common.util.buffer.BuffergetCommandBuffer(int extraSize) protected org.apache.sshd.common.util.buffer.BuffergetCommandBuffer(Object target) protected org.apache.sshd.common.util.buffer.BuffergetCommandBuffer(Object target, int extraSize) final StringgetName()final booleanorg.apache.sshd.common.util.buffer.Bufferorg.apache.sshd.common.util.buffer.Bufferreceive(int id) org.apache.sshd.common.util.buffer.Bufferreceive(int id, long timeout) org.apache.sshd.common.util.buffer.Bufferintsend(int cmd, org.apache.sshd.common.util.buffer.Buffer buffer) protected voidsendAndCheckExtendedCommandStatus(org.apache.sshd.common.util.buffer.Buffer buffer) protected intsendExtendedCommand(org.apache.sshd.common.util.buffer.Buffer buffer) protected voidthrowStatusException(int id, SftpStatus status) write(int cmd, org.apache.sshd.common.util.buffer.Buffer buffer) Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
-
Constructor Details
-
AbstractSftpClientExtension
protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, Collection<String> extras) -
AbstractSftpClientExtension
protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, Map<String, byte[]> extensions) -
AbstractSftpClientExtension
protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, boolean supported)
-
-
Method Details
-
getName
- Specified by:
getNamein interfaceNamedResource
-
getClient
- Specified by:
getClientin interfaceSftpClientHolder
-
sendAndCheckExtendedCommandStatus
protected void sendAndCheckExtendedCommandStatus(org.apache.sshd.common.util.buffer.Buffer buffer) throws IOException - Throws:
IOException
-
sendExtendedCommand
protected int sendExtendedCommand(org.apache.sshd.common.util.buffer.Buffer buffer) throws IOException - Throws:
IOException
-
send
- Specified by:
sendin interfaceRawSftpClient- Parameters:
cmd- Command to send - Note: only lower 8-bits are usedbuffer- TheBuffercontaining the command data- Returns:
- The assigned request id
- Throws:
IOException- if failed to send command
-
write
public SftpMessage write(int cmd, org.apache.sshd.common.util.buffer.Buffer buffer) throws IOException - Specified by:
writein interfaceRawSftpClient- Throws:
IOException
-
receive
- Specified by:
receivein interfaceRawSftpClient- Parameters:
id- The expected request id- Returns:
- The received response
Buffercontaining the request id - Throws:
IOException- If connection closed or interrupted
-
receive
- Specified by:
receivein interfaceRawSftpClient- Parameters:
id- The expected request idtimeout- The amount of time to wait for the response- Returns:
- The received response
Buffercontaining the request id - Throws:
IOException- If connection closed or interrupted
-
receive
public org.apache.sshd.common.util.buffer.Buffer receive(int id, Duration timeout) throws IOException - Specified by:
receivein interfaceRawSftpClient- Parameters:
id- The expected request idtimeout- The amount of time to wait for the response- Returns:
- The received response
Buffercontaining the request id - Throws:
IOException- If connection closed or interrupted
-
isSupported
public final boolean isSupported()- Specified by:
isSupportedin interfaceOptionalFeature
-
checkStatus
- Throws:
IOException
-
putTarget
public org.apache.sshd.common.util.buffer.Buffer putTarget(org.apache.sshd.common.util.buffer.Buffer buffer, Object target) - Parameters:
buffer- TheBuffertarget- A target pathStringorSftpClient.Handleorbyte[]to be encoded in the buffer- Returns:
- The updated buffer
- Throws:
UnsupportedOperationException- If target is not one of the above supported types
-
getCommandBuffer
- Parameters:
target- A target pathStringorSftpClient.Handleorbyte[]to be encoded in the buffer- Returns:
- A
Bufferwith the extension name set - See Also:
-
getCommandBuffer
- Parameters:
target- A target pathStringorSftpClient.Handleorbyte[]to be encoded in the bufferextraSize- Extra size - beyond the path/handle to be allocated- Returns:
- A
Bufferwith the extension name set - See Also:
-
getCommandBuffer
protected org.apache.sshd.common.util.buffer.Buffer getCommandBuffer(int extraSize) - Parameters:
extraSize- Extra size - besides the extension name- Returns:
- A
Bufferwith the extension name set
-
checkExtendedReplyBuffer
protected org.apache.sshd.common.util.buffer.Buffer checkExtendedReplyBuffer(org.apache.sshd.common.util.buffer.Buffer buffer) throws IOException - Parameters:
buffer- TheBufferto check- Returns:
- The
Bufferif this is anSftpConstants.SSH_FXP_EXTENDED_REPLY, ornullif this is aSftpConstants.SSH_FXP_STATUScarrying anSftpConstants.SSH_FX_OKresult - Throws:
IOException- If a non-SftpConstants.SSH_FX_OKresult or not aSftpConstants.SSH_FXP_EXTENDED_REPLYbuffer
-
throwStatusException
- Throws:
IOException
-