Package org.eclipse.jgit.transport
Interface FtpChannel
- All Known Implementing Classes:
JschSession.JschFtpChannel,SshdSession.SshdFtpChannel
public interface FtpChannel
An interface providing FTP operations over a
RemoteSession. All
operations are supposed to throw FtpChannel.FtpException for remote file system
errors and other IOExceptions on connection errors.- Since:
- 5.2
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceSimplified remote directory entry.static classAnExceptionfor reporting SFTP errors. -
Method Summary
Modifier and TypeMethodDescriptionvoidChanges the current remote directory.voidConnects theFtpChannelto the remote end.default voidDeletes a file on the remote file system.voidDisconnects andFtpChannel.Obtain anInputStreamto read the contents of a remote file.booleanLists contents of a remote directoryvoidCreates a directory on the remote file system.Obtain anOutputStreamto write to a remote file.pwd()voidRenames a file on the remote file system.voidDeletes a file on the remote file system.voidDeletes a directory on the remote file system.
-
Method Details
-
connect
Connects theFtpChannelto the remote end.- Parameters:
timeout- for establishing the FTP connectionunit- of thetimeout- Throws:
IOException
-
disconnect
void disconnect()Disconnects andFtpChannel. -
isConnected
boolean isConnected()- Returns:
- whether the
FtpChannelis connected
-
cd
Changes the current remote directory.- Parameters:
path- target directory- Throws:
IOException- if the operation could not be performed remotely
-
pwd
- Returns:
- the current remote directory path
- Throws:
IOException
-
ls
Lists contents of a remote directory- Parameters:
path- of the directory to list- Returns:
- the directory entries
- Throws:
IOException
-
rmdir
Deletes a directory on the remote file system. The directory must be empty.- Parameters:
path- to delete- Throws:
IOException
-
mkdir
Creates a directory on the remote file system.- Parameters:
path- to create- Throws:
IOException
-
get
Obtain anInputStreamto read the contents of a remote file.- Parameters:
path- of the file to read- Returns:
- the stream to read from
- Throws:
IOException
-
put
Obtain anOutputStreamto write to a remote file. If the file exists already, it will be overwritten.- Parameters:
path- of the file to read- Returns:
- the stream to read from
- Throws:
IOException
-
rm
Deletes a file on the remote file system.- Parameters:
path- to delete- Throws:
IOException- if the file does not exist or could otherwise not be deleted
-
delete
Deletes a file on the remote file system. If the file does not exist, no exception is thrown.- Parameters:
path- to delete- Throws:
IOException- if the file exist but could not be deleted
-
rename
Renames a file on the remote file system. Iftoexists, it is replaced byfrom. (POSIX rename() semantics)- Parameters:
from- original name of the fileto- new name of the file- Throws:
IOException- See Also:
-