Top Description Methods
org.apache.sshd.sftp.client.fs

public Interface WithFileAttributeCache

extends WithFileAttributes
Known Direct Implementers
org.apache.sshd.sftp.client.impl.SftpPathImpl
Imports
java.io.IOException, java.nio.file.Path, org.apache.sshd.common.util.io.functors.IOFunction, org.apache.sshd.sftp.client.SftpClient

A mix-in interface for paths that can carry and cache file attributes of the referenced file.

Method Summary

Modifier and TypeMethod and Description
public void
setAttributes(SftpClient.Attributes attributes)

Sets the attributes.

public <
result type of the operation
T
>
T

Returns:

the result of the operation
withAttributeCache
(IOFunction<Path, T>
to perform; may return null if it has no result
operation
)

Performs the given operation with attribute caching.

public static <
result type of the operation
T
>
T

Returns:

the result of the operation
withAttributeCache
(Path
Path to operate on
path
,
IOFunction<Path, T>
to perform; may return null if it has no result
operation
)

Performs the given operation with attribute caching, if the given Path implements the WithFileAttributeCache interface, otherwise simply executes the operation.

Inherited from org.apache.sshd.sftp.client.fs.WithFileAttributes:
getAttributes

Method Detail

setAttributesback to summary
public void setAttributes(SftpClient.Attributes attributes)

Sets the attributes.

Parameters
attributes:SftpClient.Attributes

SftpClient.Attributes to set

withAttributeCacheback to summary
public <T> T withAttributeCache(IOFunction<Path, T> operation) throws 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.

Parameters
<T>
result type of the operation
operation:IOFunction<Path, T>

to perform; may return null if it has no result

Returns:T

the result of the operation

Exceptions
IOException:
if thrown by the operation
withAttributeCacheback to summary
public static <T> T withAttributeCache(Path path, IOFunction<Path, T> operation) throws IOException

Performs the given operation with attribute caching, if the given Path implements the WithFileAttributeCache interface, otherwise simply executes the operation.

Parameters
<T>
result type of the operation
path:Path

Path to operate on

operation:IOFunction<Path, T>

to perform; may return null if it has no result

Returns:T

the result of the operation

Exceptions
IOException:
if thrown by the operation
See Also
withAttributeCache(IOFunction)