Interface WithFileAttributeCache

  • All Superinterfaces:
    WithFileAttributes
    All Known Implementing Classes:
    SftpPathImpl

    public interface WithFileAttributeCache
    extends WithFileAttributes
    A mix-in interface for paths that can carry and cache file attributes of the referenced file.
    • Method Detail

      • withAttributeCache

        <T> T withAttributeCache​(IOFunction<java.nio.file.Path,​T> operation)
                          throws java.io.IOException
        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 withAttributeCache(IOFunction) may be nested. The cache is cleared at the start and at the end of the outermost invocation.
        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
      • withAttributeCache

        static <T> T withAttributeCache​(java.nio.file.Path path,
                                        IOFunction<java.nio.file.Path,​T> operation)
                                 throws java.io.IOException
        Performs the given operation with attribute caching, if the given Path implements the WithFileAttributeCache interface, otherwise simply executes the operation.
        Type Parameters:
        T - result type of the operation
        Parameters:
        path - Path to operate on
        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
        See Also:
        withAttributeCache(IOFunction)