Package org.apache.sshd.sftp.client.fs
Interface WithFileAttributeCache
- All Superinterfaces:
WithFileAttributes
- All Known Implementing Classes:
SftpPathImpl
A mix-in interface for paths that can carry and cache file attributes of the referenced file.
-
Method Summary
Modifier and TypeMethodDescriptionvoidsetAttributes(SftpClient.Attributes attributes) Sets the attributes.static <T> TwithAttributeCache(Path path, org.apache.sshd.common.util.io.functors.IOFunction<Path, T> operation) Performs the given operation with attribute caching, if the givenPathimplements theWithFileAttributeCacheinterface, otherwise simply executes the operation.<T> TwithAttributeCache(org.apache.sshd.common.util.io.functors.IOFunction<Path, T> operation) Performs the given operation with attribute caching.Methods inherited from interface org.apache.sshd.sftp.client.fs.WithFileAttributes
getAttributes
-
Method Details
-
setAttributes
Sets the attributes.- Parameters:
attributes-SftpClient.Attributesto set
-
withAttributeCache
<T> T withAttributeCache(org.apache.sshd.common.util.io.functors.IOFunction<Path, T> operation) throws IOExceptionPerforms the given operation with attribute caching. IfSftpClient.Attributesare fetched by the operation, they will be cached and subsequently these cached attributes will be re-used for thisSftpPathinstance throughout the operation. Calls towithAttributeCache(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 theoperation- Parameters:
operation- to perform; may returnnullif it has no result- Returns:
- the result of the
operation - Throws:
IOException- if thrown by theoperation
-
withAttributeCache
static <T> T withAttributeCache(Path path, org.apache.sshd.common.util.io.functors.IOFunction<Path, T> operation) throws IOExceptionPerforms the given operation with attribute caching, if the givenPathimplements theWithFileAttributeCacheinterface, otherwise simply executes the operation.- Type Parameters:
T- result type of theoperation- Parameters:
path-Pathto operate onoperation- to perform; may returnnullif it has no result- Returns:
- the result of the
operation - Throws:
IOException- if thrown by theoperation- See Also:
-