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.
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public < The V extends FileAttributeView> VFileAttributeView type | Returns: a new file attribute view of the specified type bound to this directory stream, ornull if the attribute view
type is not availablethe type)Class object corresponding to the file attribute viewReturns a new file attribute view to access the file attributes of this directory. |
| public < The V extends FileAttributeView> VFileAttributeView type | Returns: a new file attribute view of the specified type bound to this directory stream, ornull if the attribute view
type is not availablethe path of the file path, Class<V> the type, LinkOption... Class object corresponding to the file attribute viewoptions indicating how symbolic links are handled options)Returns a new file attribute view to access the file attributes of a file in this directory. |
| public void | move(T
the name of the file to move srcpath, SecureDirectoryStream<T> the destination directory; can be targetdir, T nullthe name to give the file in the destination directory targetpath)Move a file from this directory to another directory. |
| public SeekableByteChannel | Returns: the seekable byte channelthe path of the file to open or create path, Set<? extends OpenOption> options specifying how the file is opened options, FileAttribute<?>... an optional list of attributes to set atomically when creating
the file attrs)Opens or creates a file in this directory, returning a seekable byte channel to access the file. |
| public SecureDirectoryStream | Returns: a new and openSecureDirectoryStream objectthe path to the directory to open path, LinkOption... options indicating how symbolic links are handled options)Opens the directory identified by the given path, returning a |
| deleteDirectory | back to summary |
|---|---|
| public void deleteDirectory(T path) throws IOException Deletes a directory. Unlike the
| |
| deleteFile | back to summary |
|---|---|
| public void deleteFile(T path) throws IOException Deletes a file. Unlike the
| |
| getFileAttributeView | back to summary |
|---|---|
| public <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 The state of resulting file attribute view is intimately connected
to this directory stream. Once the directory stream is
| |
| getFileAttributeView | back to summary |
|---|---|
| public <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 The state of resulting file attribute view is intimately connected
to this directory stream. Once the directory stream
| |
| move | back to summary |
|---|---|
| public void move(T srcpath, SecureDirectoryStream<T> targetdir, T targetpath) throws IOException Move a file from this directory to another directory. This method works in a similar manner to
| |
| newByteChannel | back to summary |
|---|---|
| public SeekableByteChannel newByteChannel(T path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException Opens or creates a file in this directory, returning a seekable byte channel to access the file. This method works in exactly the manner specified by the The channel, once created, is not dependent upon the directory stream used to create it. Closing this directory stream has no effect upon the channel.
| |
| newDirectoryStream | back to summary |
|---|---|
| public SecureDirectoryStream Opens the directory identified by the given path, returning a This method works in exactly the manner specified by the The new directory stream, once created, is not dependent upon the directory stream used to create it. Closing this directory stream has no effect upon newly created directory stream.
| |