Interface ScpTargetStreamResolver

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void closeTargetStream​(Session session, java.lang.String name, long length, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms, java.io.OutputStream stream)
      Called when target stream received from resolveTargetStream call is no longer needed since copy is successfully completed.
      java.nio.file.Path getEventListenerFilePath()  
      void postProcessReceivedData​(java.lang.String name, boolean preserve, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms, ScpTimestamp time)
      Called after successful reception of the data (and after closing the stream)
      java.io.OutputStream resolveTargetStream​(Session session, java.lang.String name, long length, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms, java.nio.file.OpenOption... options)
      Called when receiving a file in order to obtain an output stream for the incoming data
    • Method Detail

      • resolveTargetStream

        java.io.OutputStream resolveTargetStream​(Session session,
                                                 java.lang.String name,
                                                 long length,
                                                 java.util.Set<java.nio.file.attribute.PosixFilePermission> perms,
                                                 java.nio.file.OpenOption... options)
                                          throws java.io.IOException
        Called when receiving a file in order to obtain an output stream for the incoming data
        Parameters:
        session - The associated Session
        name - File name as received from remote site
        length - Number of bytes expected to receive
        perms - The Set of PosixFilePermission expected
        options - The OpenOptions to use - may be null/empty
        Returns:
        The OutputStream to write the incoming data
        Throws:
        java.io.IOException - If failed to create the stream
      • closeTargetStream

        default void closeTargetStream​(Session session,
                                       java.lang.String name,
                                       long length,
                                       java.util.Set<java.nio.file.attribute.PosixFilePermission> perms,
                                       java.io.OutputStream stream)
                                throws java.io.IOException
        Called when target stream received from resolveTargetStream call is no longer needed since copy is successfully completed.
        Parameters:
        session - The associated Session
        name - File name as received from remote site
        length - Number of bytes expected to receive
        perms - The Set of PosixFilePermission expected
        stream - The OutputStream 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.
      • getEventListenerFilePath

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

        void postProcessReceivedData​(java.lang.String name,
                                     boolean preserve,
                                     java.util.Set<java.nio.file.attribute.PosixFilePermission> perms,
                                     ScpTimestamp time)
                              throws java.io.IOException
        Called after successful reception of the data (and after closing the stream)
        Parameters:
        name - File name as received from remote site
        preserve - If true then the resolver should attempt to preserve the specified permissions and timestamp
        perms - The Set of PosixFilePermission expected
        time - If not null then the required timestamp(s) on the incoming data
        Throws:
        java.io.IOException - If failed to post-process the incoming data