Top Description Inners Methods
org.eclipse.jgit.transport

public Interface FtpChannel

Imports
java.io.FileNotFoundException, .IOException, .InputStream, .OutputStream, java.util.Collection, java.util.concurrent.TimeUnit

An interface providing FTP operations over a RemoteSession. All operations are supposed to throw FtpException for remote file system errors and other IOExceptions on connection errors.
Since
5.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
FtpChannel.DirEntry

Simplified remote directory entry.

public static class
FtpChannel.FtpException

An Exception for reporting SFTP errors.

Method Summary

Modifier and TypeMethod and Description
public void
cd(String
target directory
path
)

Changes the current remote directory.

public void
connect(int
for establishing the FTP connection
timeout
,
TimeUnit
of the timeout
unit
)

Connects the FtpChannel to the remote end.

public default void
delete(String
to delete
path
)

Deletes a file on the remote file system.

public void
disconnect()

Disconnects and FtpChannel.

public InputStream

Returns:

the stream to read from
get
(String
of the file to read
path
)

Obtain an InputStream to read the contents of a remote file.

public boolean

Returns:

whether the FtpChannel is connected
isConnected
()

Whether the FtpChannel is connected

public Collection<FtpChannel.DirEntry>

Returns:

the directory entries
ls
(String
of the directory to list
path
)

Lists contents of a remote directory

public void
mkdir(String
to create
path
)

Creates a directory on the remote file system.

public OutputStream

Returns:

the stream to read from
put
(String
of the file to read
path
)

Obtain an OutputStream to write to a remote file.

public String

Returns:

the current remote directory path
pwd
()

Get current remote directory path

public void
rename(String
original name of the file
from
,
String
new name of the file
to
)

Renames a file on the remote file system.

public void
rm(String
to delete
path
)

Deletes a file on the remote file system.

public void
rmdir(String
to delete
path
)

Deletes a directory on the remote file system.

Method Detail

cdback to summary
public void cd(String path) throws IOException

Changes the current remote directory.

Parameters
path:String

target directory

Exceptions
IOException:
if the operation could not be performed remotely
connectback to summary
public void connect(int timeout, TimeUnit unit) throws IOException

Connects the FtpChannel to the remote end.

Parameters
timeout:int

for establishing the FTP connection

unit:TimeUnit

of the timeout

Exceptions
IOException:
if an IO error occurred
deleteback to summary
public default void delete(String path) throws IOException

Deletes a file on the remote file system. If the file does not exist, no exception is thrown.

Parameters
path:String

to delete

Exceptions
IOException:
if the file exist but could not be deleted
disconnectback to summary
public void disconnect()

Disconnects and FtpChannel.

getback to summary
public InputStream get(String path) throws IOException

Obtain an InputStream to read the contents of a remote file.

Parameters
path:String

of the file to read

Returns:InputStream

the stream to read from

Exceptions
IOException:
if an IO error occurred
isConnectedback to summary
public boolean isConnected()

Whether the FtpChannel is connected

Returns:boolean

whether the FtpChannel is connected

lsback to summary
public Collection<FtpChannel.DirEntry> ls(String path) throws IOException

Lists contents of a remote directory

Parameters
path:String

of the directory to list

Returns:Collection<FtpChannel.DirEntry>

the directory entries

Exceptions
IOException:
if an IO error occurred
mkdirback to summary
public void mkdir(String path) throws IOException

Creates a directory on the remote file system.

Parameters
path:String

to create

Exceptions
IOException:
if an IO error occurred
putback to summary
public OutputStream put(String path) throws IOException

Obtain an OutputStream to write to a remote file. If the file exists already, it will be overwritten.

Parameters
path:String

of the file to read

Returns:OutputStream

the stream to read from

Exceptions
IOException:
if an IO error occurred
pwdback to summary
public String pwd() throws IOException

Get current remote directory path

Returns:String

the current remote directory path

Exceptions
IOException:
if an IO error occurred
renameback to summary
public void rename(String from, String to) throws IOException

Renames a file on the remote file system. If to exists, it is replaced by from. (POSIX rename() semantics)

Parameters
from:String

original name of the file

to:String

new name of the file

Exceptions
IOException:
if an IO error occurred
See Also
stdio.h: rename()
rmback to summary
public void rm(String path) throws IOException

Deletes a file on the remote file system.

Parameters
path:String

to delete

Exceptions
IOException:
if the file does not exist or could otherwise not be deleted
rmdirback to summary
public void rmdir(String path) throws IOException

Deletes a directory on the remote file system. The directory must be empty.

Parameters
path:String

to delete

Exceptions
IOException:
if an IO error occurred
org.eclipse.jgit.transport back to summary

public Interface FtpChannel.DirEntry


Simplified remote directory entry.

Method Summary

Modifier and TypeMethod and Description
public String
public long
public boolean

Method Detail

getFilenameback to summary
public String getFilename()
getModifiedTimeback to summary
public long getModifiedTime()
isDirectoryback to summary
public boolean isDirectory()
org.eclipse.jgit.transport back to summary

public Class FtpChannel.FtpException

extends IOException
Class Inheritance

An Exception for reporting SFTP errors.

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final int
public static final int
public static final int
private static final long
private final int
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
public
FtpException(String message, int status)

public
FtpException(String message, int status, Throwable cause)

Method Summary

Modifier and TypeMethod and Description
public int

Field Detail

EOFback to summary
public static final int EOF
NO_PERMISSIONback to summary
public static final int NO_PERMISSION
NO_SUCH_FILEback to summary
public static final int NO_SUCH_FILE
OKback to summary
public static final int OK
PROTOCOL_ERRORback to summary
public static final int PROTOCOL_ERROR
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.io.IOException.serialVersionUID.

statusback to summary
private final int status
UNSPECIFIED_FAILUREback to summary
public static final int UNSPECIFIED_FAILURE
UNSUPPORTEDback to summary
public static final int UNSUPPORTED

Constructor Detail

FtpExceptionback to summary
public FtpException(String message, int status)
FtpExceptionback to summary
public FtpException(String message, int status, Throwable cause)

Method Detail

getStatusback to summary
public int getStatus()