Package Summary  Overview Summary

class:SecureDirectoryStream [NONE]

All Superinterfaces:
AutoCloseable, Closeable, DirectoryStream<T>, Iterable<T>

public interface SecureDirectoryStream<T>
extends DirectoryStream<T>
A DirectoryStream that defines operations on files that are located relative to an open directory. A SecureDirectoryStream is intended for use by sophisticated or security sensitive applications requiring to traverse file trees or otherwise operate on directories in a race-free manner. Race conditions can arise when a sequence of file operations cannot be carried out in isolation. Each of the file operations defined by this interface specify a relative path. All access to the file is relative to the open directory irrespective of if the directory is moved or replaced by an attacker while the directory is open. A SecureDirectoryStream may also be used as a virtual working directory .

A SecureDirectoryStream requires corresponding support from the underlying operating system. Where an implementation supports this features then the DirectoryStream returned by the newDirectoryStream method will be a SecureDirectoryStream and must be cast to that type in order to invoke the methods defined by this interface.

In the case of the default provider, and a security manager is set, then the permission checks are performed using the path obtained by resolving the given relative path against the original path of the directory (irrespective of if the directory is moved since it was opened).

Since:
1.7

method:getFileAttributeView(java.lang.Class) [NONE]

  • getFileAttributeView

    <V extends FileAttributeView>  V getFileAttributeView​(Class<V> type)
    Returns a new file attribute view to access the file attributes of this directory.

    The resulting file attribute view can be used to read or update the attributes of this (open) directory. The type parameter specifies the type of the attribute view and the method returns an instance of that type if supported. Invoking this method to obtain a BasicFileAttributeView always returns an instance of that class that is bound to this open directory.

    The state of resulting file attribute view is intimately connected to this directory stream. Once the directory stream is closed, then all methods to read or update attributes will throw ClosedDirectoryStreamException.

    Type Parameters:
    V - The FileAttributeView type
    Parameters:
    type - the Class object corresponding to the file attribute view
    Returns:
    a new file attribute view of the specified type bound to this directory stream, or null if the attribute view type is not available
  • getFileAttributeView

    <V extends FileAttributeView>  V getFileAttributeView​(T path, Class<V> type, LinkOption... options)
    Returns a new file attribute view to access the file attributes of a file in this directory.

    The resulting file attribute view can be used to read or update the attributes of file in this directory. The type parameter specifies the type of the attribute view and the method returns an instance of that type if supported. Invoking this method to obtain a BasicFileAttributeView always returns an instance of that class that is bound to the file in the directory.

    The state of resulting file attribute view is intimately connected to this directory stream. Once the directory stream closed, then all methods to read or update attributes will throw ClosedDirectoryStreamException. The file is not required to exist at the time that the file attribute view is created but methods to read or update attributes of the file will fail when invoked and the file does not exist.

    Type Parameters:
    V - The FileAttributeView type
    Parameters:
    path - the path of the file
    type - the Class object corresponding to the file attribute view
    options - options indicating how symbolic links are handled
    Returns:
    a new file attribute view of the specified type bound to a this directory stream, or null if the attribute view type is not available
  • © 2020 Oracle Corporation and/or its affiliates