Package net.schmizz.sshj.sftp
Class SFTPEngine
- java.lang.Object
-
- net.schmizz.sshj.sftp.SFTPEngine
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_TIMEOUT_MSprotected org.slf4j.Loggerlogprotected LoggerFactoryloggerFactoryLoggerstatic intMAX_SUPPORTED_VERSIONprotected intoperativeVersionprotected java.io.OutputStreamoutprotected PathHelperpathHelperprotected PacketReaderreaderprotected longreqIDprotected java.util.Map<java.lang.String,java.lang.String>serverExtensionsprotected Session.Subsystemsubprotected inttimeoutMs
-
Constructor Summary
Constructors Constructor Description SFTPEngine(SessionFactory ssh)SFTPEngine(SessionFactory ssh, java.lang.String pathSep)
-
Method Summary
Modifier and Type Method Description java.lang.Stringcanonicalize(java.lang.String path)voidclose()protected LoggerFactorygetLoggerFactory()intgetOperativeProtocolVersion()PathHelpergetPathHelper()java.lang.StringgetServerExtensionData(java.lang.String extension, java.lang.String domain)Session.SubsystemgetSubsystem()intgetTimeoutMs()SFTPEngineinit()protected SFTPEngineinit(int requestedVersion)Introduced for internal use by testcases.FileAttributeslstat(java.lang.String path)voidmakeDir(java.lang.String path)voidmakeDir(java.lang.String path, FileAttributes attrs)RequestnewExtendedRequest(java.lang.String reqName)RequestnewRequest(PacketType type)RemoteFileopen(java.lang.String filename)RemoteFileopen(java.lang.String filename, java.util.Set<OpenMode> modes)RemoteFileopen(java.lang.String path, java.util.Set<OpenMode> modes, FileAttributes fa)RemoteDirectoryopenDir(java.lang.String path)java.lang.StringreadLink(java.lang.String path)protected static java.lang.StringreadSingleName(Response res)Using UTF-8protected static java.lang.StringreadSingleName(Response res, java.nio.charset.Charset charset)Using any character setvoidremove(java.lang.String filename)voidremoveDir(java.lang.String path)voidrename(java.lang.String oldPath, java.lang.String newPath, java.util.Set<RenameFlags> flags)Promise<Response,SFTPException>request(Request req)voidsetAttributes(java.lang.String path, FileAttributes attrs)voidsetTimeoutMs(int timeoutMs)FileAttributesstat(java.lang.String path)protected FileAttributesstat(PacketType pt, java.lang.String path)booleansupportsServerExtension(java.lang.String extension, java.lang.String domain)voidsymlink(java.lang.String linkpath, java.lang.String targetpath)protected voidtransmit(SFTPPacket<Request> payload)
-
-
-
Field Detail
-
MAX_SUPPORTED_VERSION
public static final int MAX_SUPPORTED_VERSION
- See Also:
- Constant Field Values
-
DEFAULT_TIMEOUT_MS
public static final int DEFAULT_TIMEOUT_MS
- See Also:
- Constant Field Values
-
loggerFactory
protected final LoggerFactory loggerFactory
Logger
-
log
protected final org.slf4j.Logger log
-
timeoutMs
protected volatile int timeoutMs
-
pathHelper
protected final PathHelper pathHelper
-
sub
protected final Session.Subsystem sub
-
reader
protected final PacketReader reader
-
out
protected final java.io.OutputStream out
-
reqID
protected long reqID
-
operativeVersion
protected int operativeVersion
-
serverExtensions
protected final java.util.Map<java.lang.String,java.lang.String> serverExtensions
-
-
Constructor Detail
-
SFTPEngine
public SFTPEngine(SessionFactory ssh) throws SSHException
- Throws:
SSHException
-
SFTPEngine
public SFTPEngine(SessionFactory ssh, java.lang.String pathSep) throws SSHException
- Throws:
SSHException
-
-
Method Detail
-
init
public SFTPEngine init() throws java.io.IOException
- Throws:
java.io.IOException
-
init
protected SFTPEngine init(int requestedVersion) throws java.io.IOException
Introduced for internal use by testcases.- Parameters:
requestedVersion-- Throws:
java.io.IOException
-
getSubsystem
public Session.Subsystem getSubsystem()
-
getOperativeProtocolVersion
public int getOperativeProtocolVersion()
-
supportsServerExtension
public boolean supportsServerExtension(java.lang.String extension, java.lang.String domain)
-
getServerExtensionData
public java.lang.String getServerExtensionData(java.lang.String extension, java.lang.String domain)
-
newExtendedRequest
public Request newExtendedRequest(java.lang.String reqName)
-
getPathHelper
public PathHelper getPathHelper()
- Specified by:
getPathHelperin interfaceRequester
-
newRequest
public Request newRequest(PacketType type)
- Specified by:
newRequestin interfaceRequester
-
request
public Promise<Response,SFTPException> request(Request req) throws java.io.IOException
-
open
public RemoteFile open(java.lang.String path, java.util.Set<OpenMode> modes, FileAttributes fa) throws java.io.IOException
- Throws:
java.io.IOException
-
open
public RemoteFile open(java.lang.String filename, java.util.Set<OpenMode> modes) throws java.io.IOException
- Throws:
java.io.IOException
-
open
public RemoteFile open(java.lang.String filename) throws java.io.IOException
- Throws:
java.io.IOException
-
openDir
public RemoteDirectory openDir(java.lang.String path) throws java.io.IOException
- Throws:
java.io.IOException
-
setAttributes
public void setAttributes(java.lang.String path, FileAttributes attrs) throws java.io.IOException- Throws:
java.io.IOException
-
readLink
public java.lang.String readLink(java.lang.String path) throws java.io.IOException- Throws:
java.io.IOException
-
makeDir
public void makeDir(java.lang.String path, FileAttributes attrs) throws java.io.IOException- Throws:
java.io.IOException
-
makeDir
public void makeDir(java.lang.String path) throws java.io.IOException- Throws:
java.io.IOException
-
symlink
public void symlink(java.lang.String linkpath, java.lang.String targetpath) throws java.io.IOException- Throws:
java.io.IOException
-
remove
public void remove(java.lang.String filename) throws java.io.IOException- Throws:
java.io.IOException
-
removeDir
public void removeDir(java.lang.String path) throws java.io.IOException- Throws:
java.io.IOException
-
stat
public FileAttributes stat(java.lang.String path) throws java.io.IOException
- Throws:
java.io.IOException
-
lstat
public FileAttributes lstat(java.lang.String path) throws java.io.IOException
- Throws:
java.io.IOException
-
rename
public void rename(java.lang.String oldPath, java.lang.String newPath, java.util.Set<RenameFlags> flags) throws java.io.IOException- Throws:
java.io.IOException
-
canonicalize
public java.lang.String canonicalize(java.lang.String path) throws java.io.IOException- Throws:
java.io.IOException
-
setTimeoutMs
public void setTimeoutMs(int timeoutMs)
-
getTimeoutMs
public int getTimeoutMs()
- Specified by:
getTimeoutMsin interfaceRequester
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
getLoggerFactory
protected LoggerFactory getLoggerFactory()
-
stat
protected FileAttributes stat(PacketType pt, java.lang.String path) throws java.io.IOException
- Throws:
java.io.IOException
-
readSingleName
protected static java.lang.String readSingleName(Response res) throws java.io.IOException
Using UTF-8- Throws:
java.io.IOException
-
readSingleName
protected static java.lang.String readSingleName(Response res, java.nio.charset.Charset charset) throws java.io.IOException
Using any character set- Throws:
java.io.IOException
-
transmit
protected void transmit(SFTPPacket<Request> payload) throws java.io.IOException
- Throws:
java.io.IOException
-
-