Class SftpPathImpl

    • Constructor Detail

      • SftpPathImpl

        public SftpPathImpl​(SftpFileSystem fileSystem,
                            java.lang.String root,
                            java.util.List<java.lang.String> names)
    • Method Detail

      • cacheAttributes

        protected void cacheAttributes​(boolean doCache)
        SftpPath instances can cache SFTP SftpClient.Attributes. Caching can be enabled by passing true. If the SftpPath instance is already caching attributes, a counter is increased only. To disable caching, pass false, which decreases the counter. The cache is cleared when the counter reaches zero again.

        Each call of cacheAttributes(true) must be matched by a call to cacheAttributes(false). Such call pairs can be nested; caching is enabled for the duration of the outermost such pair. The outermost call passing true clears any possibly already cached attributes so that the next attempt to read remote attributes will fetch them anew.

        Client code should use WithFileAttributeCache.withAttributeCache(Path, IOFunction), which ensures the above condition.

        Parameters:
        doCache - whether to start caching (increasing the cache level) or to stop caching (decreasing the cache level)
        See Also:
        WithFileAttributeCache.withAttributeCache(Path, IOFunction)
      • withAttributeCache

        public <T> T withAttributeCache​(IOFunction<java.nio.file.Path,​T> operation)
                                 throws java.io.IOException
        Description copied from interface: WithFileAttributeCache
        Performs the given operation with attribute caching. If SftpClient.Attributes are fetched by the operation, they will be cached and subsequently these cached attributes will be re-used for this SftpPath instance throughout the operation. Calls to WithFileAttributeCache.withAttributeCache(IOFunction) may be nested. The cache is cleared at the start and at the end of the outermost invocation.
        Specified by:
        withAttributeCache in interface WithFileAttributeCache
        Type Parameters:
        T - result type of the operation
        Parameters:
        operation - to perform; may return null if it has no result
        Returns:
        the result of the operation
        Throws:
        java.io.IOException - if thrown by the operation