Top Fields Constructors Methods
org.apache.sshd.sftp.client.fs

public Class SftpPosixFileAttributeView

extends AbstractSftpFileAttributeView
implements PosixFileAttributeView
Class Inheritance
All Implemented Interfaces
java.nio.file.attribute.PosixFileAttributeView, java.nio.file.attribute.FileOwnerAttributeView, java.nio.file.attribute.FileAttributeView, java.nio.file.attribute.AttributeView, java.nio.file.attribute.BasicFileAttributeView
Imports
java.io.IOException, java.nio.file.LinkOption, .Path, java.nio.file.attribute.FileTime, .GroupPrincipal, .PosixFileAttributeView, .PosixFileAttributes, .PosixFilePermission, .UserPrincipal, java.util.Set, org.apache.sshd.common.util.GenericUtils, org.apache.sshd.common.util.io.IoUtils, org.apache.sshd.sftp.client.SftpClient, org.apache.sshd.sftp.client.impl.AbstractSftpFileAttributeView

Author
Apache MINA SSHD Project

Field Summary

Inherited from org.apache.sshd.sftp.client.impl.AbstractSftpFileAttributeView:
optionspathprovider

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public UserPrincipal
public String
public PosixFileAttributes
readAttributes()

Implements java.nio.file.attribute.PosixFileAttributeView.readAttributes.

Reads the basic file attributes as a bulk operation.

public void
setGroup(GroupPrincipal
the new file group-owner
group
)

Implements java.nio.file.attribute.PosixFileAttributeView.setGroup.

Updates the file group-owner.

public void
setOwner(UserPrincipal
the new file owner
owner
)

Implements java.nio.file.attribute.FileOwnerAttributeView.setOwner.

Updates the file owner.

public void
setPermissions(Set<PosixFilePermission>
the new set of permissions
perms
)

Implements java.nio.file.attribute.PosixFileAttributeView.setPermissions.

Updates the file permissions.

public void
setTimes(FileTime
the new last modified time, or null to not change the value
lastModifiedTime
,
FileTime
the last access time, or null to not change the value
lastAccessTime
,
FileTime
the file's create time, or null to not change the value
createTime
)

Implements java.nio.file.attribute.BasicFileAttributeView.setTimes.

Updates any or all of the file's last modified time, last access time, and create time attributes.

Inherited from org.apache.sshd.sftp.client.impl.AbstractSftpFileAttributeView:
getPathproviderreadRemoteAttributeswriteRemoteAttributes

Constructor Detail

SftpPosixFileAttributeViewback to summary
public SftpPosixFileAttributeView(SftpFileSystemProvider provider, Path path, LinkOption... options)

Method Detail

getOwnerback to summary
public UserPrincipal getOwner() throws IOException

Implements java.nio.file.attribute.FileOwnerAttributeView.getOwner.

Doc from java.nio.file.attribute.FileOwnerAttributeView.getOwner.

Read the file owner.

It is implementation specific if the file owner can be a group.

Returns:UserPrincipal

the file owner

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
nameback to summary
public String name()

Overrides org.apache.sshd.sftp.client.impl.AbstractSftpFileAttributeView.name.

Implements java.nio.file.attribute.PosixFileAttributeView.name, java.nio.file.attribute.AttributeView.name.

Doc from java.nio.file.attribute.PosixFileAttributeView.name.

Returns the name of the attribute view. Attribute views of this type have the name "posix".

Returns:String

Doc from java.nio.file.attribute.AttributeView.name.

the name of the attribute view

Annotations
@Override
readAttributesback to summary
public PosixFileAttributes readAttributes() throws IOException

Implements java.nio.file.attribute.PosixFileAttributeView.readAttributes.

Doc from java.nio.file.attribute.BasicFileAttributeView.readAttributes.

Reads the basic file attributes as a bulk operation.

It is implementation specific if all file attributes are read as an atomic operation with respect to other file system operations.

Returns:PosixFileAttributes

the file attributes

Annotations
@Override
Exceptions
IOException:

Doc from java.nio.file.attribute.PosixFileAttributeView.readAttributes.

if an I/O error occurs

setGroupback to summary
public void setGroup(GroupPrincipal group) throws IOException

Implements java.nio.file.attribute.PosixFileAttributeView.setGroup.

Doc from java.nio.file.attribute.PosixFileAttributeView.setGroup.

Updates the file group-owner.

Parameters
group:GroupPrincipal

the new file group-owner

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
setOwnerback to summary
public void setOwner(UserPrincipal owner) throws IOException

Implements java.nio.file.attribute.FileOwnerAttributeView.setOwner.

Doc from java.nio.file.attribute.FileOwnerAttributeView.setOwner.

Updates the file owner.

It is implementation specific if the file owner can be a group. To ensure consistent and correct behavior across platforms it is recommended that this method should only be used to set the file owner to a user principal that is not a group.

Parameters
owner:UserPrincipal

the new file owner

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs, or the owner parameter is a group and this implementation does not support setting the owner to a group
setPermissionsback to summary
public void setPermissions(Set<PosixFilePermission> perms) throws IOException

Implements java.nio.file.attribute.PosixFileAttributeView.setPermissions.

Doc from java.nio.file.attribute.PosixFileAttributeView.setPermissions.

Updates the file permissions.

Parameters
perms:Set<PosixFilePermission>

the new set of permissions

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
setTimesback to summary
public void setTimes(FileTime lastModifiedTime, FileTime lastAccessTime, FileTime createTime) throws IOException

Implements java.nio.file.attribute.BasicFileAttributeView.setTimes.

Doc from java.nio.file.attribute.BasicFileAttributeView.setTimes.

Updates any or all of the file's last modified time, last access time, and create time attributes.

This method updates the file's timestamp attributes. The values are converted to the epoch and precision supported by the file system. Converting from finer to coarser granularities results in precision loss. The behavior of this method when attempting to set a timestamp that is not supported or to a value that is outside the range supported by the underlying file store is not defined. It may or not fail by throwing an IOException.

If any of the lastModifiedTime, lastAccessTime, or createTime parameters has the value null then the corresponding timestamp is not changed. An implementation may require to read the existing values of the file attributes when only some, but not all, of the timestamp attributes are updated. Consequently, this method may not be an atomic operation with respect to other file system operations. Reading and re-writing existing values may also result in precision loss. If all of the lastModifiedTime, lastAccessTime and createTime parameters are null then this method has no effect.

Usage Example: Suppose we want to change a file's last access time.

Path path = ... FileTime time = ... Files.getFileAttributeView(path, BasicFileAttributeView.class).setTimes(null, time, null);
Path path = ...
FileTime time = ...
Files.getFileAttributeView(path, BasicFileAttributeView.class).setTimes(null, time, null);
Parameters
lastModifiedTime:FileTime

the new last modified time, or null to not change the value

lastAccessTime:FileTime

the last access time, or null to not change the value

createTime:FileTime

the file's create time, or null to not change the value

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs