Interface ScpSourceStreamResolver

All Known Implementing Classes:
DefaultScpStreamResolver, LocalFileScpSourceStreamResolver

public interface ScpSourceStreamResolver
  • Method Details

    • getFileName

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

      Path getEventListenerFilePath()
      Returns:
      The Path to use when invoking the ScpTransferEventListener
    • getPermissions

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

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

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

      InputStream resolveSourceStream(Session session, long fileSize, Set<PosixFilePermission> permissions, OpenOption... options) throws 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:
      IOException - If failed to create the stream
    • closeSourceStream

      default void closeSourceStream(Session session, long fileSize, Set<PosixFilePermission> permissions, InputStream stream) throws 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:
      IOException - If failed to close the stream - Note: stream will be closed regardless of whether this method throws an exception or not.