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(String path)
Changes the current remote directory.
|
void |
connect(int timeout,
TimeUnit unit)
Connects the
FtpChannel to the remote end. |
default void |
delete(String path)
Deletes a file on the remote file system.
|
void |
disconnect()
Disconnects and
FtpChannel . |
InputStream |
get(String path)
Obtain an
InputStream to read the contents of a remote file. |
boolean |
isConnected() |
Collection<FtpChannel.DirEntry> |
ls(String path)
Lists contents of a remote directory
|
void |
mkdir(String path)
Creates a directory on the remote file system.
|
OutputStream |
put(String path)
Obtain an
OutputStream to write to a remote file. |
String |
pwd() |
void |
rename(String from,
String to)
Renames a file on the remote file system.
|
void |
rm(String path)
Deletes a file on the remote file system.
|
void |
rmdir(String path)
Deletes a directory on the remote file system.
|
void connect(int timeout, TimeUnit unit) throws IOException
FtpChannel
to the remote end.timeout
- for establishing the FTP connectionunit
- of the timeout
IOException
void disconnect()
FtpChannel
.boolean isConnected()
FtpChannel
is connectedvoid cd(String path) throws IOException
path
- target directoryIOException
- if the operation could not be performed remotelyString pwd() throws IOException
IOException
Collection<FtpChannel.DirEntry> ls(String path) throws IOException
path
- of the directory to listIOException
void rmdir(String path) throws IOException
path
- to deleteIOException
void mkdir(String path) throws IOException
path
- to createIOException
InputStream get(String path) throws IOException
InputStream
to read the contents of a remote file.path
- of the file to readIOException
OutputStream put(String path) throws IOException
OutputStream
to write to a remote file. If the file
exists already, it will be overwritten.path
- of the file to readIOException
void rm(String path) throws IOException
path
- to deleteIOException
- if the file does not exist or could otherwise not be deleteddefault void delete(String path) throws IOException
path
- to deleteIOException
- if the file exist but could not be deletedvoid rename(String from, String to) throws IOException
to
exists, it is
replaced by from
. (POSIX rename() semantics)from
- original name of the fileto
- new name of the fileIOException
Copyright © 2019 Eclipse JGit Project. All rights reserved.