Package com.jcraft.jsch
Class ChannelSftp
java.lang.Object
com.jcraft.jsch.Channel
com.jcraft.jsch.ChannelSftp
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfaceThis interface will be passed as an argument forlsmethod. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanstatic final intprotected Hashtable<byte[], byte[]> static final intprotected booleanstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intprotected intprotected byte[]protected intprotected intprotected Stringprotected intprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid_put(InputStream src, String dst, SftpProgressMonitor monitor, int mode) voidvoidvoidvoidvoidvoidexit()Deprecated.This method will be deleted in the future.get(String src, SftpProgressMonitor monitor) get(String src, SftpProgressMonitor monitor, int mode) Deprecated.This method will be deleted in the future.get(String src, SftpProgressMonitor monitor, long skip) voidget(String src, OutputStream dst) voidget(String src, OutputStream dst, SftpProgressMonitor monitor) voidget(String src, OutputStream dst, SftpProgressMonitor monitor, int mode, long skip) voidvoidget(String src, String dst, SftpProgressMonitor monitor) voidget(String src, String dst, SftpProgressMonitor monitor, int mode) intThis method will return the value how many requests may be sent at any one time.getExtension(String key) getHome()intbooleanvoidvoidlpwd()voidls(String path, ChannelSftp.LsEntrySelector selector) List files specified by the remotepath.voidvoidput(InputStream src, String dst) voidput(InputStream src, String dst, int mode) voidput(InputStream src, String dst, SftpProgressMonitor monitor) voidput(InputStream src, String dst, SftpProgressMonitor monitor, int mode) Sends data from the input streamsrctodstfile.put(String dst, SftpProgressMonitor monitor, int mode) put(String dst, SftpProgressMonitor monitor, int mode, long offset) Sends data from the output stream todstfile.voidvoidvoidput(String src, String dst, SftpProgressMonitor monitor) voidput(String src, String dst, SftpProgressMonitor monitor, int mode) Sends data fromsrcfile todstfile.pwd()voidquit()voidvoidvoidprotected voidvoidsetAgentForwarding(boolean enable) Enable the agent forwarding.voidsetBulkRequests(int bulk_requests) Specify how many requests may be sent at any one time.voidsetEnv(byte[] name, byte[] value) Set the environment variable.voidSet the environment variable.voidDeprecated.Use #setEnv(String, String) or #setEnv(byte[], byte[]) instead.voidsetFilenameEncoding(String encoding) Deprecated.voidsetFilenameEncoding(Charset encoding) voidvoidsetPty(boolean enable) Allocate a Pseudo-Terminal.voidsetPtySize(int col, int row, int wp, int hp) Change the window dimension interactively.voidsetPtyType(String ttype) Set the terminal type.voidsetPtyType(String ttype, int col, int row, int wp, int hp) Set the terminal type.voidvoidsetTerminalMode(byte[] terminal_mode) Set the terminal mode.voidsetUseWriteFlushWorkaround(boolean useWriteFlushWorkaround) voidsetXForwarding(boolean enable) Enable the X11 forwarding.voidstart()voidversion()Methods inherited from class com.jcraft.jsch.Channel
connect, connect, genChannelOpenPacket, getExitStatus, getExtInputStream, getId, getInputStream, getOutputStream, getSession, isClosed, isConnected, isEOF, sendChannelOpen, sendOpenConfirmation, sendOpenFailure, sendSignal, setExtOutputStream, setExtOutputStream, setInputStream, setInputStream, setOutputStream, setOutputStream
-
Field Details
-
SSH_FX_OK
public static final int SSH_FX_OK- See Also:
-
SSH_FX_EOF
public static final int SSH_FX_EOF- See Also:
-
SSH_FX_NO_SUCH_FILE
public static final int SSH_FX_NO_SUCH_FILE- See Also:
-
SSH_FX_PERMISSION_DENIED
public static final int SSH_FX_PERMISSION_DENIED- See Also:
-
SSH_FX_FAILURE
public static final int SSH_FX_FAILURE- See Also:
-
SSH_FX_BAD_MESSAGE
public static final int SSH_FX_BAD_MESSAGE- See Also:
-
SSH_FX_NO_CONNECTION
public static final int SSH_FX_NO_CONNECTION- See Also:
-
SSH_FX_CONNECTION_LOST
public static final int SSH_FX_CONNECTION_LOST- See Also:
-
SSH_FX_OP_UNSUPPORTED
public static final int SSH_FX_OP_UNSUPPORTED- See Also:
-
OVERWRITE
public static final int OVERWRITE- See Also:
-
RESUME
public static final int RESUME- See Also:
-
APPEND
public static final int APPEND- See Also:
-
agent_forwarding
protected boolean agent_forwarding -
xforwading
protected boolean xforwading -
env
-
pty
protected boolean pty -
ttype
-
tcol
protected int tcol -
trow
protected int trow -
twp
protected int twp -
thp
protected int thp -
terminal_mode
protected byte[] terminal_mode
-
-
Constructor Details
-
ChannelSftp
public ChannelSftp()
-
-
Method Details
-
setBulkRequests
Specify how many requests may be sent at any one time. Increasing this value may slightly improve file transfer speed but will increase memory usage. The default is 16 requests.- Parameters:
bulk_requests- how many requests may be outstanding at any one time.- Throws:
JSchException
-
getBulkRequests
public int getBulkRequests()This method will return the value how many requests may be sent at any one time.- Returns:
- how many requests may be sent at any one time.
-
setUseWriteFlushWorkaround
public void setUseWriteFlushWorkaround(boolean useWriteFlushWorkaround) -
getUseWriteFlushWorkaround
public boolean getUseWriteFlushWorkaround() -
start
- Overrides:
startin classChannel- Throws:
JSchException
-
quit
public void quit() -
exit
public void exit() -
lcd
- Throws:
SftpException
-
cd
- Throws:
SftpException
-
put
- Throws:
SftpException
-
put
- Throws:
SftpException
-
put
- Throws:
SftpException
-
put
Sends data fromsrcfile todstfile. Themodeshould beOVERWRITE,RESUMEorAPPEND.- Parameters:
src- source filedst- destination filemonitor- progress monitormode- how data should be added to dst- Throws:
SftpException
-
put
- Throws:
SftpException
-
put
- Throws:
SftpException
-
put
- Throws:
SftpException
-
put
public void put(InputStream src, String dst, SftpProgressMonitor monitor, int mode) throws SftpException Sends data from the input streamsrctodstfile. Themodeshould beOVERWRITE,RESUMEorAPPEND.- Parameters:
src- input streamdst- destination filemonitor- progress monitormode- how data should be added to dst- Throws:
SftpException
-
_put
public void _put(InputStream src, String dst, SftpProgressMonitor monitor, int mode) throws SftpException - Throws:
SftpException
-
put
- Throws:
SftpException
-
put
- Throws:
SftpException
-
put
- Throws:
SftpException
-
put
public OutputStream put(String dst, SftpProgressMonitor monitor, int mode, long offset) throws SftpException Sends data from the output stream todstfile. Themodeshould beOVERWRITE,RESUMEorAPPEND.- Parameters:
dst- destination filemonitor- progress monitormode- how data should be added to dstoffset- data will be added at offset- Returns:
- output stream, which accepts data to be transferred.
- Throws:
SftpException
-
get
- Throws:
SftpException
-
get
- Throws:
SftpException
-
get
- Throws:
SftpException
-
get
- Throws:
SftpException
-
get
- Throws:
SftpException
-
get
public void get(String src, OutputStream dst, SftpProgressMonitor monitor, int mode, long skip) throws SftpException - Throws:
SftpException
-
get
- Throws:
SftpException
-
get
- Throws:
SftpException
-
get
Deprecated.This method will be deleted in the future.- Throws:
SftpException
-
get
@Deprecated public InputStream get(String src, SftpProgressMonitor monitor, int mode) throws SftpException Deprecated.This method will be deleted in the future.- Throws:
SftpException
-
get
- Throws:
SftpException
-
ls
- Throws:
SftpException
-
ls
List files specified by the remotepath. Each files and directories will be passed toLsEntrySelector#select(LsEntry)method, and if that method returnsLsEntrySelector#BREAK, the operation will be canceled immediately.- Throws:
SftpException- Since:
- 0.1.47
- See Also:
-
readlink
- Throws:
SftpException
-
symlink
- Throws:
SftpException
-
hardlink
- Throws:
SftpException
-
rename
- Throws:
SftpException
-
rm
- Throws:
SftpException
-
chgrp
- Throws:
SftpException
-
chown
- Throws:
SftpException
-
chmod
- Throws:
SftpException
-
setMtime
- Throws:
SftpException
-
rmdir
- Throws:
SftpException
-
mkdir
- Throws:
SftpException
-
stat
- Throws:
SftpException
-
statVFS
- Throws:
SftpException
-
lstat
- Throws:
SftpException
-
setStat
- Throws:
SftpException
-
pwd
- Throws:
SftpException
-
lpwd
-
version
-
getHome
- Throws:
SftpException
-
disconnect
public void disconnect()- Overrides:
disconnectin classChannel
-
getServerVersion
- Throws:
SftpException
-
setFilenameEncoding
Deprecated.- Throws:
SftpException
-
setFilenameEncoding
-
getExtension
-
realpath
- Throws:
SftpException
-
setAgentForwarding
public void setAgentForwarding(boolean enable) Enable the agent forwarding.- Parameters:
enable-
-
setXForwarding
public void setXForwarding(boolean enable) Enable the X11 forwarding. Refer to RFC4254 6.3.1. Requesting X11 Forwarding.- Overrides:
setXForwardingin classChannel- Parameters:
enable-
-
setEnv
Deprecated.Use #setEnv(String, String) or #setEnv(byte[], byte[]) instead.- See Also:
-
setEnv
Set the environment variable. Ifnameandvalueare needed to be passed to the remote in your favorite encoding, usesetEnv(byte[], byte[]). Refer to RFC4254 6.4 Environment Variable Passing.- Parameters:
name- A name for environment variable.value- A value for environment variable.
-
setEnv
public void setEnv(byte[] name, byte[] value) Set the environment variable. Refer to RFC4254 6.4 Environment Variable Passing.- Parameters:
name- A name of environment variable.value- A value of environment variable.- See Also:
-
setPty
public void setPty(boolean enable) Allocate a Pseudo-Terminal. Refer to RFC4254 6.2. Requesting a Pseudo-Terminal.- Parameters:
enable-
-
setTerminalMode
public void setTerminalMode(byte[] terminal_mode) Set the terminal mode.- Parameters:
terminal_mode-
-
setPtySize
public void setPtySize(int col, int row, int wp, int hp) Change the window dimension interactively. Refer to RFC4254 6.7. Window Dimension Change Message.- Parameters:
col- terminal width, columnsrow- terminal height, rowswp- terminal width, pixelshp- terminal height, pixels
-
setPtyType
Set the terminal type. This method is not effective after Channel#connect().- Parameters:
ttype- terminal type(for example, "vt100")- See Also:
-
setPtyType
Set the terminal type. This method is not effective after Channel#connect().- Parameters:
ttype- terminal type(for example, "vt100")col- terminal width, columnsrow- terminal height, rowswp- terminal width, pixelshp- terminal height, pixels
-
sendRequests
- Throws:
Exception
-