Package org.eclipse.jgit.transport
Class JschSession.JschFtpChannel
- java.lang.Object
-
- org.eclipse.jgit.transport.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.ChannelSftpftp
-
Constructor Summary
Constructors Modifier Constructor Description privateJschFtpChannel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcd(java.lang.String path)Changes the current remote directory.voidconnect(int timeout, java.util.concurrent.TimeUnit unit)Connects theFtpChannelto the remote end.voiddisconnect()Disconnects andFtpChannel.java.io.InputStreamget(java.lang.String path)Obtain anInputStreamto read the contents of a remote file.private booleanhasPosixRename()Determine whether the server has the posix-rename extension.booleanisConnected()java.util.Collection<FtpChannel.DirEntry>ls(java.lang.String path)Lists contents of a remote directoryprivate <T> Tmap(java.util.concurrent.Callable<T> op)voidmkdir(java.lang.String path)Creates a directory on the remote file system.java.io.OutputStreamput(java.lang.String path)Obtain anOutputStreamto write to a remote file.java.lang.Stringpwd()voidrename(java.lang.String from, java.lang.String to)Renames a file on the remote file system.voidrm(java.lang.String path)Deletes a file on the remote file system.voidrmdir(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.IOExceptionDescription copied from interface:FtpChannelConnects theFtpChannelto the remote end.- Specified by:
connectin interfaceFtpChannel- Parameters:
timeout- for establishing the FTP connectionunit- of thetimeout- Throws:
java.io.IOException
-
disconnect
public void disconnect()
Description copied from interface:FtpChannelDisconnects andFtpChannel.- Specified by:
disconnectin 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:
isConnectedin interfaceFtpChannel- Returns:
- whether the
FtpChannelis connected
-
cd
public void cd(java.lang.String path) throws java.io.IOExceptionDescription copied from interface:FtpChannelChanges the current remote directory.- Specified by:
cdin 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:
pwdin 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:FtpChannelLists contents of a remote directory- Specified by:
lsin 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.IOExceptionDescription copied from interface:FtpChannelDeletes a directory on the remote file system. The directory must be empty.- Specified by:
rmdirin interfaceFtpChannel- Parameters:
path- to delete- Throws:
java.io.IOException
-
mkdir
public void mkdir(java.lang.String path) throws java.io.IOExceptionDescription copied from interface:FtpChannelCreates a directory on the remote file system.- Specified by:
mkdirin interfaceFtpChannel- Parameters:
path- to create- Throws:
java.io.IOException
-
get
public java.io.InputStream get(java.lang.String path) throws java.io.IOExceptionDescription copied from interface:FtpChannelObtain anInputStreamto read the contents of a remote file.- Specified by:
getin 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.IOExceptionDescription copied from interface:FtpChannelObtain anOutputStreamto write to a remote file. If the file exists already, it will be overwritten.- Specified by:
putin 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.IOExceptionDescription copied from interface:FtpChannelDeletes a file on the remote file system.- Specified by:
rmin 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.IOExceptionDescription copied from interface:FtpChannelRenames a file on the remote file system. Iftoexists, it is replaced byfrom. (POSIX rename() semantics)- Specified by:
renamein 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:
trueif it is supported,falseotherwise- See Also:
- OpenSSH deviations and extensions to the published SSH protocol, stdio.h: rename()
-
-