public interface SftpClient extends SubsystemClient
Modifier and Type | Interface and Description |
---|---|
static class |
SftpClient.Attribute |
static class |
SftpClient.Attributes |
static class |
SftpClient.CloseableHandle |
static class |
SftpClient.CopyMode |
static class |
SftpClient.DirEntry |
static class |
SftpClient.Handle |
static class |
SftpClient.OpenMode |
NamedResource.Utils
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_CHANNEL_OPEN_TIMEOUT |
static int |
DEFAULT_READ_BUFFER_SIZE |
static long |
DEFAULT_WAIT_TIMEOUT |
static int |
DEFAULT_WRITE_BUFFER_SIZE |
static int |
IO_BUFFER_SIZE |
static int |
MIN_BUFFER_SIZE |
static int |
MIN_READ_BUFFER_SIZE |
static int |
MIN_WRITE_BUFFER_SIZE |
static String |
SFTP_CHANNEL_OPEN_TIMEOUT
Property that can be used on the
FactoryManager
to control the internal timeout used by the client to open a channel. |
BY_NAME_COMPARATOR, NAME_EXTRACTOR
getClientChannel
getSession
getClientSession
getName
static final int MIN_BUFFER_SIZE
static final int MIN_READ_BUFFER_SIZE
static final int MIN_WRITE_BUFFER_SIZE
static final int IO_BUFFER_SIZE
static final int DEFAULT_READ_BUFFER_SIZE
static final int DEFAULT_WRITE_BUFFER_SIZE
static final long DEFAULT_WAIT_TIMEOUT
static final String SFTP_CHANNEL_OPEN_TIMEOUT
FactoryManager
to control the internal timeout used by the client to open a channel.
If not specified then DEFAULT_CHANNEL_OPEN_TIMEOUT
value
is usedstatic final long DEFAULT_CHANNEL_OPEN_TIMEOUT
int getVersion()
Map<String,byte[]> getServerExtensions()
Map
of the reported server extensions.boolean isClosing()
SftpClient.CloseableHandle open(String path) throws IOException
path
- The remote pathSftpClient.CloseableHandle
IOException
- If failed to open the remote fileSftpClient.CloseableHandle open(String path, SftpClient.OpenMode... options) throws IOException
path
- The remote pathoptions
- The desired mode - if none specified
then SftpClient.OpenMode.Read
is assumedSftpClient.CloseableHandle
IOException
- If failed to open the remote fileSftpClient.CloseableHandle open(String path, Collection<SftpClient.OpenMode> options) throws IOException
path
- The remote pathoptions
- The desired mode - if none specified
then SftpClient.OpenMode.Read
is assumedSftpClient.CloseableHandle
IOException
- If failed to open the remote filevoid close(SftpClient.Handle handle) throws IOException
IOException
void remove(String path) throws IOException
IOException
void rename(String oldPath, String newPath) throws IOException
IOException
void rename(String oldPath, String newPath, SftpClient.CopyMode... options) throws IOException
IOException
void rename(String oldPath, String newPath, Collection<SftpClient.CopyMode> options) throws IOException
IOException
int read(SftpClient.Handle handle, long fileOffset, byte[] dst) throws IOException
handle
- The file SftpClient.Handle
to read fromfileOffset
- The file offset to read fromdst
- The destination buffer-1
if EOF reachedIOException
- If failed to read the dataread(Handle, long, byte[], int, int)
int read(SftpClient.Handle handle, long fileOffset, byte[] dst, AtomicReference<Boolean> eofSignalled) throws IOException
handle
- The file SftpClient.Handle
to read fromfileOffset
- The file offset to read fromdst
- The destination buffereofSignalled
- If not null
then upon return holds a value indicating
whether EOF was reached due to the read. If null
indicator
value then this indication is not available-1
if EOF reachedIOException
- If failed to read the dataread(Handle, long, byte[], int, int, AtomicReference)
,
SFTP v6 - section 9.3int read(SftpClient.Handle handle, long fileOffset, byte[] dst, int dstOffset, int len) throws IOException
IOException
int read(SftpClient.Handle handle, long fileOffset, byte[] dst, int dstOffset, int len, AtomicReference<Boolean> eofSignalled) throws IOException
handle
- The file SftpClient.Handle
to read fromfileOffset
- The file offset to read fromdst
- The destination bufferdstOffset
- Offset in destination buffer to place the read datalen
- Available destination buffer size to readeofSignalled
- If not null
then upon return holds a value indicating
whether EOF was reached due to the read. If null
indicator
value then this indication is not available-1
if EOF reachedIOException
- If failed to read the datavoid write(SftpClient.Handle handle, long fileOffset, byte[] src) throws IOException
IOException
void write(SftpClient.Handle handle, long fileOffset, byte[] src, int srcOffset, int len) throws IOException
IOException
void mkdir(String path) throws IOException
IOException
void rmdir(String path) throws IOException
IOException
SftpClient.CloseableHandle openDir(String path) throws IOException
IOException
List<SftpClient.DirEntry> readDir(SftpClient.Handle handle) throws IOException
handle
- Directory SftpClient.Handle
to read fromList
of entries - null
to indicate no more entries
Note: the list may be incomplete since the client and
server have some internal imposed limit on the number of entries they
can process. Therefore several calls to this method may be required
(until null
). In order to iterate over all the entries use
readDir(String)
IOException
- If failed to access the remote siteList<SftpClient.DirEntry> readDir(SftpClient.Handle handle, AtomicReference<Boolean> eolIndicator) throws IOException
handle
- Directory SftpClient.Handle
to read fromeolIndicator
- An indicator that can be used to get information
whether end of list has been reached - ignored if null
. Upon
return, set value indicates whether all entries have been exhausted - a null
value means that this information cannot be provided and another call to
readDir
is necessary in order to verify that no more entries are pendingList
of entries - null
to indicate no more entriesIOException
- If failed to access the remote siteString canonicalPath(String path) throws IOException
IOException
SftpClient.Attributes stat(String path) throws IOException
IOException
SftpClient.Attributes lstat(String path) throws IOException
IOException
SftpClient.Attributes stat(SftpClient.Handle handle) throws IOException
IOException
void setStat(String path, SftpClient.Attributes attributes) throws IOException
IOException
void setStat(SftpClient.Handle handle, SftpClient.Attributes attributes) throws IOException
IOException
String readLink(String path) throws IOException
IOException
void symLink(String linkPath, String targetPath) throws IOException
IOException
void link(String linkPath, String targetPath, boolean symbolic) throws IOException
IOException
void lock(SftpClient.Handle handle, long offset, long length, int mask) throws IOException
IOException
void unlock(SftpClient.Handle handle, long offset, long length) throws IOException
IOException
Iterable<SftpClient.DirEntry> readDir(String path) throws IOException
path
- The remote directory pathIterable
that can be used to iterate over all the
directory entries (unlike readDir(Handle)
)IOException
- If failed to access the remote sitereadDir(Handle)
InputStream read(String path) throws IOException
IOException
InputStream read(String path, int bufferSize) throws IOException
IOException
InputStream read(String path, SftpClient.OpenMode... mode) throws IOException
IOException
InputStream read(String path, int bufferSize, SftpClient.OpenMode... mode) throws IOException
IOException
InputStream read(String path, Collection<SftpClient.OpenMode> mode) throws IOException
IOException
InputStream read(String path, int bufferSize, Collection<SftpClient.OpenMode> mode) throws IOException
IOException
OutputStream write(String path) throws IOException
IOException
OutputStream write(String path, int bufferSize) throws IOException
IOException
OutputStream write(String path, SftpClient.OpenMode... mode) throws IOException
IOException
OutputStream write(String path, int bufferSize, SftpClient.OpenMode... mode) throws IOException
IOException
OutputStream write(String path, Collection<SftpClient.OpenMode> mode) throws IOException
IOException
OutputStream write(String path, int bufferSize, Collection<SftpClient.OpenMode> mode) throws IOException
IOException
<E extends SftpClientExtension> E getExtension(Class<? extends E> extensionType)
E
- The generic extension typeextensionType
- The extension typeOptionalFeature.isSupported()
- null
if
this extension type is not implemented by the clientgetServerExtensions()
SftpClientExtension getExtension(String extensionName)
extensionName
- The extension nameOptionalFeature.isSupported()
- null
if
this extension type is not implemented by the clientgetServerExtensions()
Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.