Class JschSession.JschFtpChannel
- java.lang.Object
-
- org.eclipse.jgit.transport.ssh.jsch.JschSession.JschFtpChannel
-
- All Implemented Interfaces:
FtpChannel
- Enclosing class:
- JschSession
private class JschSession.JschFtpChannel extends java.lang.Object implements FtpChannel
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jgit.transport.FtpChannel
FtpChannel.DirEntry, FtpChannel.FtpException
-
-
Field Summary
Fields Modifier and Type Field Description private com.jcraft.jsch.ChannelSftp
ftp
-
Constructor Summary
Constructors Modifier Constructor Description private
JschFtpChannel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cd(java.lang.String path)
Changes the current remote directory.void
connect(int timeout, java.util.concurrent.TimeUnit unit)
Connects theFtpChannel
to the remote end.void
disconnect()
Disconnects andFtpChannel
.java.io.InputStream
get(java.lang.String path)
Obtain anInputStream
to read the contents of a remote file.private boolean
hasPosixRename()
Determine whether the server has the posix-rename extension.boolean
isConnected()
java.util.Collection<FtpChannel.DirEntry>
ls(java.lang.String path)
Lists contents of a remote directoryprivate <T> T
map(java.util.concurrent.Callable<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 anOutputStream
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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.jgit.transport.FtpChannel
delete
-
-
-
-
Method Detail
-
connect
public void connect(int timeout, java.util.concurrent.TimeUnit unit) throws java.io.IOException
Description copied from interface:FtpChannel
Connects theFtpChannel
to the remote end.- Specified by:
connect
in interfaceFtpChannel
- Parameters:
timeout
- for establishing the FTP connectionunit
- of thetimeout
- Throws:
java.io.IOException
-
disconnect
public void disconnect()
Description copied from interface:FtpChannel
Disconnects andFtpChannel
.- Specified by:
disconnect
in interfaceFtpChannel
-
map
private <T> T map(java.util.concurrent.Callable<T> op) throws java.io.IOException
- Throws:
java.io.IOException
-
isConnected
public boolean isConnected()
- Specified by:
isConnected
in interfaceFtpChannel
- Returns:
- whether the
FtpChannel
is connected
-
cd
public void cd(java.lang.String path) throws java.io.IOException
Description copied from interface:FtpChannel
Changes the current remote directory.- Specified by:
cd
in interfaceFtpChannel
- Parameters:
path
- target directory- Throws:
java.io.IOException
- if the operation could not be performed remotely
-
pwd
public java.lang.String pwd() throws java.io.IOException
- Specified by:
pwd
in interfaceFtpChannel
- Returns:
- the current remote directory path
- Throws:
java.io.IOException
-
ls
public java.util.Collection<FtpChannel.DirEntry> ls(java.lang.String path) throws java.io.IOException
Description copied from interface:FtpChannel
Lists contents of a remote directory- Specified by:
ls
in interfaceFtpChannel
- Parameters:
path
- of the directory to list- Returns:
- the directory entries
- Throws:
java.io.IOException
-
rmdir
public void rmdir(java.lang.String path) throws java.io.IOException
Description copied from interface:FtpChannel
Deletes a directory on the remote file system. The directory must be empty.- Specified by:
rmdir
in interfaceFtpChannel
- Parameters:
path
- to delete- Throws:
java.io.IOException
-
mkdir
public void mkdir(java.lang.String path) throws java.io.IOException
Description copied from interface:FtpChannel
Creates a directory on the remote file system.- Specified by:
mkdir
in interfaceFtpChannel
- Parameters:
path
- to create- Throws:
java.io.IOException
-
get
public java.io.InputStream get(java.lang.String path) throws java.io.IOException
Description copied from interface:FtpChannel
Obtain anInputStream
to read the contents of a remote file.- Specified by:
get
in interfaceFtpChannel
- Parameters:
path
- of the file to read- Returns:
- the stream to read from
- Throws:
java.io.IOException
-
put
public java.io.OutputStream put(java.lang.String path) throws java.io.IOException
Description copied from interface:FtpChannel
Obtain anOutputStream
to write to a remote file. If the file exists already, it will be overwritten.- Specified by:
put
in interfaceFtpChannel
- Parameters:
path
- of the file to read- Returns:
- the stream to read from
- Throws:
java.io.IOException
-
rm
public void rm(java.lang.String path) throws java.io.IOException
Description copied from interface:FtpChannel
Deletes a file on the remote file system.- Specified by:
rm
in interfaceFtpChannel
- Parameters:
path
- to delete- Throws:
java.io.IOException
- if the file does not exist or could otherwise not be deleted
-
rename
public void rename(java.lang.String from, java.lang.String to) throws java.io.IOException
Description copied from interface:FtpChannel
Renames a file on the remote file system. Ifto
exists, it is replaced byfrom
. (POSIX rename() semantics)- Specified by:
rename
in interfaceFtpChannel
- Parameters:
from
- original name of the fileto
- new name of the file- Throws:
java.io.IOException
- See Also:
- stdio.h: rename()
-
hasPosixRename
private boolean hasPosixRename()
Determine whether the server has the posix-rename extension.- Returns:
true
if it is supported,false
otherwise- See Also:
- OpenSSH deviations and extensions to the published SSH protocol, stdio.h: rename()
-
-