public interface FtpChannel
RemoteSession
. All
operations are supposed to throw FtpChannel.FtpException
for remote file system
errors and other IOExceptions on connection errors.Modifier and Type | Interface and Description |
---|---|
static interface |
FtpChannel.DirEntry
Simplified remote directory entry.
|
static class |
FtpChannel.FtpException
An
Exception for reporting SFTP errors. |
Modifier and Type | Method and Description |
---|---|
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. |
default void |
delete(java.lang.String path)
Deletes a file on the remote file system.
|
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
|
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.
|
void connect(int timeout, java.util.concurrent.TimeUnit unit) throws java.io.IOException
FtpChannel
to the remote end.timeout
- for establishing the FTP connectionunit
- of the timeout
java.io.IOException
void disconnect()
FtpChannel
.boolean isConnected()
FtpChannel
is connectedvoid cd(java.lang.String path) throws java.io.IOException
path
- target directoryjava.io.IOException
- if the operation could not be performed remotelyjava.lang.String pwd() throws java.io.IOException
java.io.IOException
java.util.Collection<FtpChannel.DirEntry> ls(java.lang.String path) throws java.io.IOException
path
- of the directory to listjava.io.IOException
void rmdir(java.lang.String path) throws java.io.IOException
path
- to deletejava.io.IOException
void mkdir(java.lang.String path) throws java.io.IOException
path
- to createjava.io.IOException
java.io.InputStream get(java.lang.String path) throws java.io.IOException
InputStream
to read the contents of a remote file.path
- of the file to readjava.io.IOException
java.io.OutputStream put(java.lang.String path) throws java.io.IOException
OutputStream
to write to a remote file. If the file
exists already, it will be overwritten.path
- of the file to readjava.io.IOException
void rm(java.lang.String path) throws java.io.IOException
path
- to deletejava.io.IOException
- if the file does not exist or could otherwise not be deleteddefault void delete(java.lang.String path) throws java.io.IOException
path
- to deletejava.io.IOException
- if the file exist but could not be deletedvoid rename(java.lang.String from, java.lang.String to) throws java.io.IOException
to
exists, it is
replaced by from
. (POSIX rename() semantics)from
- original name of the fileto
- new name of the filejava.io.IOException