Class SftpFileSystem.Wrapper

    • Field Detail

      • readSize

        private final int readSize
      • writeSize

        private final int writeSize
      • open

        private final java.util.concurrent.atomic.AtomicBoolean open
    • Method Detail

      • getVersion

        public int getVersion()
        Returns:
        The negotiated SFTP protocol version
      • getServerExtensions

        public java.util.NavigableMap<java.lang.String,​byte[]> getServerExtensions()
        Returns:
        An (unmodifiable) NavigableMap of the reported server extensions. where key=extension name (case insensitive)
      • getNameDecodingCharset

        public java.nio.charset.Charset getNameDecodingCharset()
        Returns:
        The (never null) Charset used to decode referenced files/folders names
        See Also:
        SftpModuleProperties.NAME_DECODING_CHARSET
      • setNameDecodingCharset

        public void setNameDecodingCharset​(java.nio.charset.Charset cs)
      • isClosing

        public boolean isClosing()
      • isOpen

        public boolean isOpen()
      • close

        public void close()
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • close

        public void close​(SftpClient.Handle handle)
                   throws java.io.IOException
        Description copied from interface: SftpClient
        Close the handle obtained from one of the open methods
        Specified by:
        close in interface SftpClient
        Overrides:
        close in class AbstractSftpClient
        Parameters:
        handle - The Handle to close
        Throws:
        java.io.IOException - If failed to execute
      • remove

        public void remove​(java.lang.String path)
                    throws java.io.IOException
        Specified by:
        remove in interface SftpClient
        Overrides:
        remove in class AbstractSftpClient
        Parameters:
        path - The remote path to remove
        Throws:
        java.io.IOException - If failed to execute
      • read

        public int read​(SftpClient.Handle handle,
                        long fileOffset,
                        byte[] dst,
                        int dstOffset,
                        int len)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        public void write​(SftpClient.Handle handle,
                          long fileOffset,
                          byte[] src,
                          int srcOffset,
                          int len)
                   throws java.io.IOException
        Description copied from interface: SftpClient
        Write data to (open) file handle
        Specified by:
        write in interface SftpClient
        Overrides:
        write in class AbstractSftpClient
        Parameters:
        handle - The file SftpClient.Handle
        fileOffset - Zero-based offset to write in file
        src - Data buffer
        srcOffset - Offset of valid data in buffer
        len - Number of bytes to write
        Throws:
        java.io.IOException - If failed to write the data
      • mkdir

        public void mkdir​(java.lang.String path)
                   throws java.io.IOException
        Description copied from interface: SftpClient
        Create remote directory
        Specified by:
        mkdir in interface SftpClient
        Overrides:
        mkdir in class AbstractSftpClient
        Parameters:
        path - Remote directory path
        Throws:
        java.io.IOException - If failed to execute
      • rmdir

        public void rmdir​(java.lang.String path)
                   throws java.io.IOException
        Description copied from interface: SftpClient
        Remove remote directory
        Specified by:
        rmdir in interface SftpClient
        Overrides:
        rmdir in class AbstractSftpClient
        Parameters:
        path - Remote directory path
        Throws:
        java.io.IOException - If failed to execute
      • readDir

        public java.util.List<SftpClient.DirEntry> readDir​(SftpClient.Handle handle)
                                                    throws java.io.IOException
        Parameters:
        handle - Directory SftpClient.Handle to read from
        Returns:
        A List of entries - null to indicate no more entries Note: the list may be incomplete since the client and server have some internal imposed limit on the number of entries they can process. Therefore several calls to this method may be required (until null). In order to iterate over all the entries use SftpClient.readDir(String)
        Throws:
        java.io.IOException - If failed to access the remote site
      • canonicalPath

        public java.lang.String canonicalPath​(java.lang.String path)
                                       throws java.io.IOException
        Description copied from interface: SftpClient
        The effective "normalized" remote path
        Specified by:
        canonicalPath in interface SftpClient
        Overrides:
        canonicalPath in class AbstractSftpClient
        Parameters:
        path - The requested path - may be relative, and/or contain dots - e.g., ".", "..", "./foo", "../bar"
        Returns:
        The effective "normalized" remote path
        Throws:
        java.io.IOException - If failed to execute
      • readLink

        public java.lang.String readLink​(java.lang.String path)
                                  throws java.io.IOException
        Description copied from interface: SftpClient
        Retrieve target of a link
        Specified by:
        readLink in interface SftpClient
        Overrides:
        readLink in class AbstractSftpClient
        Parameters:
        path - Remote path that represents a link
        Returns:
        The link target
        Throws:
        java.io.IOException - If failed to execute
      • symLink

        public void symLink​(java.lang.String linkPath,
                            java.lang.String targetPath)
                     throws java.io.IOException
        Description copied from interface: SftpClient
        Create symbolic link
        Parameters:
        linkPath - The link location
        targetPath - The referenced target by the link
        Throws:
        java.io.IOException - If failed to execute
        See Also:
        SftpClient.link(String, String, boolean)
      • readDir

        public java.util.List<SftpClient.DirEntry> readDir​(SftpClient.Handle handle,
                                                           java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> eolIndicator)
                                                    throws java.io.IOException
        Specified by:
        readDir in interface SftpClient
        Overrides:
        readDir in class AbstractSftpClient
        Parameters:
        handle - Directory SftpClient.Handle to read from
        eolIndicator - An indicator that can be used to get information whether end of list has been reached - ignored if null. Upon return, set value indicates whether all entries have been exhausted - a null value means that this information cannot be provided and another call to readDir is necessary in order to verify that no more entries are pending
        Returns:
        A List of entries - null to indicate no more entries
        Throws:
        java.io.IOException - If failed to access the remote site
        See Also:
        SFTP v6 - section 9.4
      • read

        public java.io.InputStream read​(java.lang.String path)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public java.io.InputStream read​(java.lang.String path,
                                        SftpClient.OpenMode... mode)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public java.io.InputStream read​(java.lang.String path,
                                        java.util.Collection<SftpClient.OpenMode> mode)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        public java.io.OutputStream write​(java.lang.String path)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        public java.io.OutputStream write​(java.lang.String path,
                                          SftpClient.OpenMode... mode)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        public java.io.OutputStream write​(java.lang.String path,
                                          java.util.Collection<SftpClient.OpenMode> mode)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • put

        public void put​(java.nio.file.Path localFile,
                        java.lang.String path)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • put

        public void put​(java.io.InputStream stream,
                        java.lang.String path)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • put

        public void put​(java.nio.file.Path localFile,
                        java.lang.String path,
                        SftpClient.OpenMode... modes)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • put

        public void put​(java.io.InputStream stream,
                        java.lang.String path,
                        SftpClient.OpenMode... modes)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • put

        public void put​(java.nio.file.Path localFile,
                        java.lang.String path,
                        java.util.Collection<SftpClient.OpenMode> modes)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • put

        public void put​(java.io.InputStream stream,
                        java.lang.String path,
                        java.util.Collection<SftpClient.OpenMode> modes)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • link

        public void link​(java.lang.String linkPath,
                         java.lang.String targetPath,
                         boolean symbolic)
                  throws java.io.IOException
        Description copied from interface: SftpClient
        Create a link
        Specified by:
        link in interface SftpClient
        Overrides:
        link in class AbstractSftpClient
        Parameters:
        linkPath - The link location
        targetPath - The referenced target by the link
        symbolic - If true then make this a symbolic link, otherwise a hard one
        Throws:
        java.io.IOException - If failed to execute
      • send

        public int send​(int cmd,
                        Buffer buffer)
                 throws java.io.IOException
        Parameters:
        cmd - Command to send - Note: only lower 8-bits are used
        buffer - The Buffer containing the command data
        Returns:
        The assigned request id
        Throws:
        java.io.IOException - if failed to send command
      • write

        public SftpMessage write​(int cmd,
                                 Buffer buffer)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • receive

        public Buffer receive​(int id)
                       throws java.io.IOException
        Parameters:
        id - The expected request id
        Returns:
        The received response Buffer containing the request id
        Throws:
        java.io.IOException - If connection closed or interrupted
      • receive

        public Buffer receive​(int id,
                              long timeout)
                       throws java.io.IOException
        Parameters:
        id - The expected request id
        timeout - The amount of time to wait for the response
        Returns:
        The received response Buffer containing the request id
        Throws:
        java.io.IOException - If connection closed or interrupted
      • receive

        public Buffer receive​(int id,
                              java.time.Duration timeout)
                       throws java.io.IOException
        Parameters:
        id - The expected request id
        timeout - The amount of time to wait for the response
        Returns:
        The received response Buffer containing the request id
        Throws:
        java.io.IOException - If connection closed or interrupted