Interface ScpSourceStreamResolver

    • Method Detail

      • getFileName

        java.lang.String getFileName()
                              throws java.io.IOException
        Returns:
        The uploaded file name
        Throws:
        java.io.IOException - If failed to resolve the name
      • getEventListenerFilePath

        java.nio.file.Path getEventListenerFilePath()
        Returns:
        The Path to use when invoking the ScpTransferEventListener
      • getPermissions

        java.util.Collection<java.nio.file.attribute.PosixFilePermission> getPermissions()
                                                                                  throws java.io.IOException
        Returns:
        The permissions to be used for uploading a file
        Throws:
        java.io.IOException - If failed to generate the required permissions
      • getTimestamp

        ScpTimestampCommandDetails getTimestamp()
                                         throws java.io.IOException
        Returns:
        The ScpTimestampCommandDetails to use for uploading the file if null then no need to send this information
        Throws:
        java.io.IOException - If failed to generate the required data
      • getSize

        long getSize()
              throws java.io.IOException
        Returns:
        An estimated size of the expected number of bytes to be uploaded. If non-positive then assumed to be unknown.
        Throws:
        java.io.IOException - If failed to generate an estimate
      • resolveSourceStream

        java.io.InputStream resolveSourceStream​(Session session,
                                                long fileSize,
                                                java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions,
                                                java.nio.file.OpenOption... options)
                                         throws java.io.IOException
        Parameters:
        session - The Session through which file is transmitted
        fileSize - The expected transfer byte count
        permissions - The requested file permissions
        options - The OpenOptions may be null/empty
        Returns:
        The InputStream containing the data to be uploaded
        Throws:
        java.io.IOException - If failed to create the stream
      • closeSourceStream

        default void closeSourceStream​(Session session,
                                       long fileSize,
                                       java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions,
                                       java.io.InputStream stream)
                                throws java.io.IOException
        Called when the stream obtained from resolveSourceStream is no longer needed since since file copy was completed successfully.
        Parameters:
        session - The Session through which file is transmitted
        fileSize - The expected transfer byte count
        permissions - The requested file permissions
        stream - The InputStream to close
        Throws:
        java.io.IOException - If failed to close the stream - Note: stream will be closed regardless of whether this method throws an exception or not.