Class LocalFileScpTargetStreamResolver

    • Field Detail

      • path

        protected final java.nio.file.Path path
      • status

        protected final java.lang.Boolean status
      • file

        private java.nio.file.Path file
    • Constructor Detail

      • LocalFileScpTargetStreamResolver

        public LocalFileScpTargetStreamResolver​(java.nio.file.Path path,
                                                ScpFileOpener opener)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • resolveTargetStream

        public 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
        Description copied from interface: ScpTargetStreamResolver
        Called when receiving a file in order to obtain an output stream for the incoming data
        Specified by:
        resolveTargetStream in interface ScpTargetStreamResolver
        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

        public 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
        Description copied from interface: ScpTargetStreamResolver
        Called when target stream received from resolveTargetStream call is no longer needed since copy is successfully completed.
        Specified by:
        closeTargetStream in interface ScpTargetStreamResolver
        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.
      • postProcessReceivedData

        public void postProcessReceivedData​(java.lang.String name,
                                            boolean preserve,
                                            java.util.Set<java.nio.file.attribute.PosixFilePermission> perms,
                                            ScpTimestampCommandDetails time)
                                     throws java.io.IOException
        Description copied from interface: ScpTargetStreamResolver
        Called after successful reception of the data (and after closing the stream)
        Specified by:
        postProcessReceivedData in interface ScpTargetStreamResolver
        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
      • updateFileProperties

        protected void updateFileProperties​(java.lang.String name,
                                            java.nio.file.Path path,
                                            java.util.Set<java.nio.file.attribute.PosixFilePermission> perms,
                                            ScpTimestampCommandDetails time)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object