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 AbstractLoggingBean
implements SftpClientExtension, RawSftpClient
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SftpClientprivate final Stringprivate final RawSftpClientprivate final booleanFields 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 BuffercheckExtendedReplyBuffer(Buffer buffer) protected voidcheckStatus(Buffer buffer) final SftpClientprotected BuffergetCommandBuffer(int extraSize) protected BuffergetCommandBuffer(Object target) protected BuffergetCommandBuffer(Object target, int extraSize) final StringgetName()final booleanreceive(int id) receive(int id, long timeout) intprotected voidprotected intsendExtendedCommand(Buffer buffer) protected voidthrowStatusException(int id, SftpStatus status)
-
Field Details
-
name
-
client
-
raw
-
supported
private final boolean supported
-
-
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- Returns:
- The resource name
-
getClient
- Specified by:
getClientin interfaceSftpClientHolder
-
sendAndCheckExtendedCommandStatus
- Throws:
IOException
-
sendExtendedCommand
- 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
-
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
- 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
- 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
- Parameters:
extraSize- Extra size - besides the extension name- Returns:
- A
Bufferwith the extension name set
-
checkExtendedReplyBuffer
- 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
-