public abstract class AbstractSftpClientExtension extends AbstractLoggingBean implements SftpClientExtension, RawSftpClient
NamedResource.Utils
OptionalFeature.Utils
log
BY_NAME_COMPARATOR, NAME_EXTRACTOR
FALSE, TRUE
Modifier | Constructor and Description |
---|---|
protected |
AbstractSftpClientExtension(String name,
SftpClient client,
RawSftpClient raw,
boolean supported) |
protected |
AbstractSftpClientExtension(String name,
SftpClient client,
RawSftpClient raw,
Collection<String> extras) |
protected |
AbstractSftpClientExtension(String name,
SftpClient client,
RawSftpClient raw,
Map<String,byte[]> extensions) |
Modifier and Type | Method and Description |
---|---|
protected Buffer |
checkExtendedReplyBuffer(Buffer buffer) |
protected void |
checkStatus(Buffer buffer) |
SftpClient |
getClient() |
protected Buffer |
getCommandBuffer(int extraSize) |
protected Buffer |
getCommandBuffer(Object target) |
protected Buffer |
getCommandBuffer(Object target,
int extraSize) |
String |
getName() |
boolean |
isSupported() |
Buffer |
putTarget(Buffer buffer,
Object target) |
Buffer |
receive(int id) |
int |
send(int cmd,
Buffer buffer) |
protected void |
sendAndCheckExtendedCommandStatus(Buffer buffer) |
protected int |
sendExtendedCommand(Buffer buffer) |
protected void |
throwStatusException(int id,
int substatus,
String msg,
String lang) |
protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, Collection<String> extras)
protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, Map<String,byte[]> extensions)
protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, boolean supported)
public final String getName()
getName
in interface NamedResource
public final SftpClient getClient()
getClient
in interface SftpClientExtension
SftpClient
used to issue the extended commandprotected void sendAndCheckExtendedCommandStatus(Buffer buffer) throws IOException
IOException
protected int sendExtendedCommand(Buffer buffer) throws IOException
IOException
public int send(int cmd, Buffer buffer) throws IOException
send
in interface RawSftpClient
cmd
- Command to send - Note: only lower 8-bits are usedbuffer
- The Buffer
containing the command dataIOException
- if failed to send commandpublic Buffer receive(int id) throws IOException
receive
in interface RawSftpClient
id
- The expected request idBuffer
containing the request idIOException
- If connection closed or interruptedpublic final boolean isSupported()
isSupported
in interface OptionalFeature
protected void checkStatus(Buffer buffer) throws IOException
IOException
public Buffer putTarget(Buffer buffer, Object target)
buffer
- The Buffer
target
- A target path String
or SftpClient.Handle
or byte[]
to be encoded in the bufferUnsupportedOperationException
- If target is not one of the above
supported typesprotected Buffer getCommandBuffer(Object target)
target
- A target path String
or SftpClient.Handle
or byte[]
to be encoded in the bufferBuffer
with the extension name setgetCommandBuffer(Object, int)
protected Buffer getCommandBuffer(Object target, int extraSize)
target
- A target path String
or SftpClient.Handle
or byte[]
to be encoded in the bufferextraSize
- Extra size - beyond the path/handle to be allocatedBuffer
with the extension name setgetCommandBuffer(int)
protected Buffer getCommandBuffer(int extraSize)
extraSize
- Extra size - besides the extension nameBuffer
with the extension name setprotected Buffer checkExtendedReplyBuffer(Buffer buffer) throws IOException
buffer
- The Buffer
to checkBuffer
if this is an SftpConstants.SSH_FXP_EXTENDED_REPLY
,
or null
if this is a SftpConstants.SSH_FXP_STATUS
carrying
an SftpConstants.SSH_FX_OK
resultIOException
- If a non-SftpConstants.SSH_FX_OK
result or
not a SftpConstants.SSH_FXP_EXTENDED_REPLY
bufferprotected void throwStatusException(int id, int substatus, String msg, String lang) throws IOException
IOException
Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.