Class DefaultScpStreamResolver

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String cmd  
      private java.io.InputStream local  
      private java.nio.file.Path mockPath  
      private java.lang.String name  
      private java.util.Collection<java.nio.file.attribute.PosixFilePermission> perms  
      private long size  
      private ScpTimestamp time  
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultScpStreamResolver​(java.lang.String name, java.nio.file.Path mockPath, java.util.Collection<java.nio.file.attribute.PosixFilePermission> perms, ScpTimestamp time, long size, java.io.InputStream local, java.lang.String cmd)  
    • Field Detail

      • name

        private final java.lang.String name
      • mockPath

        private final java.nio.file.Path mockPath
      • perms

        private final java.util.Collection<java.nio.file.attribute.PosixFilePermission> perms
      • size

        private final long size
      • local

        private final java.io.InputStream local
      • cmd

        private final java.lang.String cmd
    • Constructor Detail

      • DefaultScpStreamResolver

        public DefaultScpStreamResolver​(java.lang.String name,
                                        java.nio.file.Path mockPath,
                                        java.util.Collection<java.nio.file.attribute.PosixFilePermission> perms,
                                        ScpTimestamp time,
                                        long size,
                                        java.io.InputStream local,
                                        java.lang.String cmd)
    • Method Detail

      • getFileName

        public java.lang.String getFileName()
                                     throws java.io.IOException
        Specified by:
        getFileName in interface ScpSourceStreamResolver
        Returns:
        The uploaded file name
        Throws:
        java.io.IOException - If failed to resolve the name
      • getPermissions

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

        public ScpTimestamp getTimestamp()
                                  throws java.io.IOException
        Specified by:
        getTimestamp in interface ScpSourceStreamResolver
        Returns:
        The ScpTimestamp 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

        public long getSize()
                     throws java.io.IOException
        Specified by:
        getSize in interface ScpSourceStreamResolver
        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

        public java.io.InputStream resolveSourceStream​(Session session,
                                                       long length,
                                                       java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions,
                                                       java.nio.file.OpenOption... options)
                                                throws java.io.IOException
        Specified by:
        resolveSourceStream in interface ScpSourceStreamResolver
        Parameters:
        session - The Session through which file is transmitted
        length - 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
      • toString

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