private class SshdSession.SshdFtpChannel extends java.lang.Object implements FtpChannel
FtpChannel.DirEntry, FtpChannel.FtpException| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
cwd
Current working directory.
|
private org.apache.sshd.client.subsystem.sftp.SftpClient |
ftp |
| Modifier | Constructor and Description |
|---|---|
private |
SshdFtpChannel() |
| Modifier and Type | Method and Description |
|---|---|
private java.lang.String |
absolute(java.lang.String path) |
void |
cd(java.lang.String path)
Changes the current remote directory.
|
void |
connect(int timeout,
java.util.concurrent.TimeUnit unit)
Connects the
FtpChannel to the remote end. |
void |
disconnect()
Disconnects and
FtpChannel. |
java.io.InputStream |
get(java.lang.String path)
Obtain an
InputStream to read the contents of a remote file. |
boolean |
isConnected() |
java.util.Collection<FtpChannel.DirEntry> |
ls(java.lang.String path)
Lists contents of a remote directory
|
private <T> T |
map(SshdSession.FtpOperation<T> op) |
void |
mkdir(java.lang.String path)
Creates a directory on the remote file system.
|
java.io.OutputStream |
put(java.lang.String path)
Obtain an
OutputStream to write to a remote file. |
java.lang.String |
pwd() |
void |
rename(java.lang.String from,
java.lang.String to)
Renames a file on the remote file system.
|
void |
rm(java.lang.String path)
Deletes a file on the remote file system.
|
void |
rmdir(java.lang.String path)
Deletes a directory on the remote file system.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeleteprivate org.apache.sshd.client.subsystem.sftp.SftpClient ftp
private java.lang.String cwd
public void connect(int timeout,
java.util.concurrent.TimeUnit unit)
throws java.io.IOException
FtpChannelFtpChannel to the remote end.connect in interface FtpChanneltimeout - for establishing the FTP connectionunit - of the timeoutjava.io.IOExceptionpublic void disconnect()
FtpChannelFtpChannel.disconnect in interface FtpChannelpublic boolean isConnected()
isConnected in interface FtpChannelFtpChannel is connectedprivate java.lang.String absolute(java.lang.String path)
private <T> T map(SshdSession.FtpOperation<T> op) throws java.io.IOException
java.io.IOExceptionpublic void cd(java.lang.String path)
throws java.io.IOException
FtpChannelcd in interface FtpChannelpath - target directoryjava.io.IOException - if the operation could not be performed remotelypublic java.lang.String pwd()
throws java.io.IOException
pwd in interface FtpChanneljava.io.IOExceptionpublic java.util.Collection<FtpChannel.DirEntry> ls(java.lang.String path) throws java.io.IOException
FtpChannells in interface FtpChannelpath - of the directory to listjava.io.IOExceptionpublic void rmdir(java.lang.String path)
throws java.io.IOException
FtpChannelrmdir in interface FtpChannelpath - to deletejava.io.IOExceptionpublic void mkdir(java.lang.String path)
throws java.io.IOException
FtpChannelmkdir in interface FtpChannelpath - to createjava.io.IOExceptionpublic java.io.InputStream get(java.lang.String path)
throws java.io.IOException
FtpChannelInputStream to read the contents of a remote file.get in interface FtpChannelpath - of the file to readjava.io.IOExceptionpublic java.io.OutputStream put(java.lang.String path)
throws java.io.IOException
FtpChannelOutputStream to write to a remote file. If the file
exists already, it will be overwritten.put in interface FtpChannelpath - of the file to readjava.io.IOExceptionpublic void rm(java.lang.String path)
throws java.io.IOException
FtpChannelrm in interface FtpChannelpath - to deletejava.io.IOException - if the file does not exist or could otherwise not be deletedpublic void rename(java.lang.String from,
java.lang.String to)
throws java.io.IOException
FtpChannelto exists, it is
replaced by from. (POSIX rename() semantics)rename in interface FtpChannelfrom - original name of the fileto - new name of the filejava.io.IOException