APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.nio.fs

pack-priv Class UnixSecureDirectoryStream

extends Object
implements SecureDirectoryStream<Path>
Class Inheritance
All Implemented Interfaces
java.nio.file.SecureDirectoryStream, java.nio.file.DirectoryStream, java.lang.Iterable, java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.IOException, java.nio.channels.SeekableByteChannel, java.nio.file.*, java.nio.file.attribute.*, java.util.*, java.util.concurrent.TimeUnit

Unix implementation of SecureDirectoryStream.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
UnixSecureDirectoryStream.BasicFileAttributeViewImpl

A BasicFileAttributeView implementation that using a dfd/name pair.

private class
UnixSecureDirectoryStream.PosixFileAttributeViewImpl

A PosixFileAttributeView implementation that using a dfd/name pair.

Field Summary

Modifier and TypeField and Description
private final int
private final UnixDirectoryStream

Constructor Summary

AccessConstructor and Description
pack-priv
UnixSecureDirectoryStream(UnixPath dir, long dp, int dfd, DirectoryStream.Filter<? super Path> filter)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

public void
public void
public <V extends FileAttributeView> V
getFileAttributeView(Class<V> type)

Implements java.nio.file.SecureDirectoryStream.getFileAttributeView.

Returns file attribute view bound to this directory

public <V extends FileAttributeView> V
getFileAttributeView(Path obj, Class<V> type, LinkOption... options)

Implements java.nio.file.SecureDirectoryStream.getFileAttributeView.

Returns file attribute view bound to dfd/filename.

private <V extends FileAttributeView> V
getFileAttributeViewImpl(UnixPath file, Class<V> type, boolean followLinks)

private UnixPath
private void
implDelete(Path obj, int flags)

Deletes file/directory in this directory.

public Iterator<Path>
iterator()

Implements java.nio.file.DirectoryStream.iterator.

Returns the iterator associated with this DirectoryStream.

public void
move(Path fromObj, SecureDirectoryStream<Path> dir, Path toObj)

Implements java.nio.file.SecureDirectoryStream.move.

Rename/move file in this directory to another (open) directory

public SeekableByteChannel
newByteChannel(Path obj, Set<? extends OpenOption> options, FileAttribute<?>... attrs)

Implements java.nio.file.SecureDirectoryStream.newByteChannel.

Opens file in this directory

public SecureDirectoryStream<Path>
newDirectoryStream(Path obj, LinkOption... options)

Implements java.nio.file.SecureDirectoryStream.newDirectoryStream.

Opens sub-directory in this directory

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dfdback to summary
private final int dfd
dsback to summary
private final UnixDirectoryStream ds

Constructor Detail

UnixSecureDirectoryStreamback to summary
pack-priv UnixSecureDirectoryStream(UnixPath dir, long dp, int dfd, DirectoryStream.Filter<? super Path> filter)

Method Detail

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
deleteDirectoryback to summary
public void deleteDirectory(Path dir) throws IOException

Implements java.nio.file.SecureDirectoryStream.deleteDirectory.

Doc from java.nio.file.SecureDirectoryStream.deleteDirectory.

Deletes a directory.

Unlike the delete() method, this method does not first examine the file to determine if the file is a directory. Whether non-directories are deleted by this method is system dependent and therefore not specified. When the parameter is a relative path then the directory to delete is relative to this open directory.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
deleteFileback to summary
public void deleteFile(Path file) throws IOException

Implements java.nio.file.SecureDirectoryStream.deleteFile.

Doc from java.nio.file.SecureDirectoryStream.deleteFile.

Deletes a file.

Unlike the delete() method, this method does not first examine the file to determine if the file is a directory. Whether a directory is deleted by this method is system dependent and therefore not specified. If the file is a symbolic link, then the link itself, not the final target of the link, is deleted. When the parameter is a relative path then the file to delete is relative to this open directory.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
getFileAttributeViewback to summary
public <V extends FileAttributeView> V getFileAttributeView(Class<V> type)

Implements java.nio.file.SecureDirectoryStream.getFileAttributeView.

Returns file attribute view bound to this directory

Annotations
@Override
getFileAttributeViewback to summary
public <V extends FileAttributeView> V getFileAttributeView(Path obj, Class<V> type, LinkOption... options)

Implements java.nio.file.SecureDirectoryStream.getFileAttributeView.

Returns file attribute view bound to dfd/filename.

Annotations
@Override
getFileAttributeViewImplback to summary
private <V extends FileAttributeView> V getFileAttributeViewImpl(UnixPath file, Class<V> type, boolean followLinks)
Annotations
@SuppressWarnings:unchecked
getNameback to summary
private UnixPath getName(Path obj)
implDeleteback to summary
private void implDelete(Path obj, int flags) throws IOException

Deletes file/directory in this directory. Works in a race-free manner when invoked with flags.

iteratorback to summary
public Iterator<Path> iterator()

Implements java.nio.file.DirectoryStream.iterator.

Doc from java.nio.file.DirectoryStream.iterator.

Returns the iterator associated with this DirectoryStream.

Annotations
@Override
moveback to summary
public void move(Path fromObj, SecureDirectoryStream<Path> dir, Path toObj) throws IOException

Implements java.nio.file.SecureDirectoryStream.move.

Rename/move file in this directory to another (open) directory

Annotations
@Override
Exceptions
IOException:

Doc from java.nio.file.SecureDirectoryStream.move.

if an I/O error occurs

newByteChannelback to summary
public SeekableByteChannel newByteChannel(Path obj, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException

Implements java.nio.file.SecureDirectoryStream.newByteChannel.

Opens file in this directory

Annotations
@Override
Exceptions
IOException:

Doc from java.nio.file.SecureDirectoryStream.newByteChannel.

if an I/O error occurs

newDirectoryStreamback to summary
public SecureDirectoryStream<Path> newDirectoryStream(Path obj, LinkOption... options) throws IOException

Implements java.nio.file.SecureDirectoryStream.newDirectoryStream.

Opens sub-directory in this directory

Annotations
@Override
Exceptions
IOException:

Doc from java.nio.file.SecureDirectoryStream.newDirectoryStream.

if an I/O error occurs

sun.nio.fs back to summary

private Class UnixSecureDirectoryStream.BasicFileAttributeViewImpl

extends Object
implements BasicFileAttributeView
Class Inheritance
  • java.lang.Object
  • sun.nio.fs.UnixSecureDirectoryStream.BasicFileAttributeViewImpl
All Implemented Interfaces
java.nio.file.attribute.BasicFileAttributeView, java.nio.file.attribute.FileAttributeView, java.nio.file.attribute.AttributeView
Known Direct Subclasses
sun.nio.fs.UnixSecureDirectoryStream.PosixFileAttributeViewImpl

A BasicFileAttributeView implementation that using a dfd/name pair.

Field Summary

Modifier and TypeField and Description
pack-priv final UnixPath
pack-priv final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
BasicFileAttributeViewImpl(UnixPath file, boolean followLinks)

Method Summary

Modifier and TypeMethod and Description
public String
name()

Implements java.nio.file.attribute.BasicFileAttributeView.name.

Returns the name of the attribute view.

pack-priv int
open()

public BasicFileAttributes
readAttributes()

Implements java.nio.file.attribute.BasicFileAttributeView.readAttributes.

Reads the basic file attributes as a bulk operation.

public void
setTimes(FileTime lastModifiedTime, FileTime lastAccessTime, FileTime 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 java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fileback to summary
pack-priv final UnixPath file

Constructor Detail

BasicFileAttributeViewImplback to summary
pack-priv BasicFileAttributeViewImpl(UnixPath file, boolean followLinks)

Method Detail

nameback to summary
public String name()

Implements java.nio.file.attribute.BasicFileAttributeView.name.

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

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

Annotations
@Override
openback to summary
pack-priv int open() throws IOException
readAttributesback to summary
public BasicFileAttributes readAttributes() throws IOException

Implements java.nio.file.attribute.BasicFileAttributeView.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.

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);
Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
sun.nio.fs back to summary

private Class UnixSecureDirectoryStream.PosixFileAttributeViewImpl

extends BasicFileAttributeViewImpl
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

A PosixFileAttributeView implementation that using a dfd/name pair.

Field Summary

Inherited from sun.nio.fs.UnixSecureDirectoryStream.BasicFileAttributeViewImpl:
filefollowLinks

Constructor Summary

AccessConstructor and Description
pack-priv
PosixFileAttributeViewImpl(UnixPath file, boolean followLinks)

Method Summary

Modifier and TypeMethod and Description
public UserPrincipal
public String
public PosixFileAttributes
public void
public void
private void
setOwners(int uid, int gid)

public void
Inherited from sun.nio.fs.UnixSecureDirectoryStream.BasicFileAttributeViewImpl:
opensetTimes

Constructor Detail

PosixFileAttributeViewImplback to summary
pack-priv PosixFileAttributeViewImpl(UnixPath file, boolean followLinks)

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.

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

Overrides sun.nio.fs.UnixSecureDirectoryStream.BasicFileAttributeViewImpl.name.

Implements java.nio.file.attribute.PosixFileAttributeView.name, java.nio.file.attribute.BasicFileAttributeView.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".

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

Overrides sun.nio.fs.UnixSecureDirectoryStream.BasicFileAttributeViewImpl.readAttributes.

Implements java.nio.file.attribute.PosixFileAttributeView.readAttributes, java.nio.file.attribute.BasicFileAttributeView.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.

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.

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.

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
setOwnersback to summary
private void setOwners(int uid, int gid) throws IOException
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.

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