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, wait
delete
private 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
FtpChannel
FtpChannel
to the remote end.connect
in interface FtpChannel
timeout
- for establishing the FTP connectionunit
- of the timeout
java.io.IOException
public void disconnect()
FtpChannel
FtpChannel
.disconnect
in interface FtpChannel
public boolean isConnected()
isConnected
in interface FtpChannel
FtpChannel
is connectedprivate java.lang.String absolute(java.lang.String path)
private <T> T map(SshdSession.FtpOperation<T> op) throws java.io.IOException
java.io.IOException
public void cd(java.lang.String path) throws java.io.IOException
FtpChannel
cd
in interface FtpChannel
path
- target directoryjava.io.IOException
- if the operation could not be performed remotelypublic java.lang.String pwd() throws java.io.IOException
pwd
in interface FtpChannel
java.io.IOException
public java.util.Collection<FtpChannel.DirEntry> ls(java.lang.String path) throws java.io.IOException
FtpChannel
ls
in interface FtpChannel
path
- of the directory to listjava.io.IOException
public void rmdir(java.lang.String path) throws java.io.IOException
FtpChannel
rmdir
in interface FtpChannel
path
- to deletejava.io.IOException
public void mkdir(java.lang.String path) throws java.io.IOException
FtpChannel
mkdir
in interface FtpChannel
path
- to createjava.io.IOException
public java.io.InputStream get(java.lang.String path) throws java.io.IOException
FtpChannel
InputStream
to read the contents of a remote file.get
in interface FtpChannel
path
- of the file to readjava.io.IOException
public java.io.OutputStream put(java.lang.String path) throws java.io.IOException
FtpChannel
OutputStream
to write to a remote file. If the file
exists already, it will be overwritten.put
in interface FtpChannel
path
- of the file to readjava.io.IOException
public void rm(java.lang.String path) throws java.io.IOException
FtpChannel
rm
in interface FtpChannel
path
- 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
FtpChannel
to
exists, it is
replaced by from
. (POSIX rename() semantics)rename
in interface FtpChannel
from
- original name of the fileto
- new name of the filejava.io.IOException