Class SFTPEngine

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, Requester

    public class SFTPEngine
    extends java.lang.Object
    implements Requester, java.io.Closeable
    • Field Detail

      • loggerFactory

        protected final LoggerFactory loggerFactory
        Logger
      • log

        protected final org.slf4j.Logger log
      • timeoutMs

        protected volatile int timeoutMs
      • pathHelper

        protected final PathHelper pathHelper
      • 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
    • 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
      • 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)
      • 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)
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • 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