Top Description Fields Constructors Methods
org.apache.sshd.common.file.root

public Class RootedSecureDirectoryStream

extends RootedDirectoryStream
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.LinkOption, .OpenOption, .Path, .SecureDirectoryStream, java.nio.file.attribute.FileAttribute, .FileAttributeView, java.util.Set

A secure directory stream proxy for a RootedFileSystem
Author
Apache MINA SSHD Project

Field Summary

Inherited from org.apache.sshd.common.file.root.RootedDirectoryStream:
delegaterfs

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private SecureDirectoryStream<Path>
public void
deleteDirectory(Path
the path of the directory to delete
path
)

Implements java.nio.file.SecureDirectoryStream.deleteDirectory.

Deletes a directory.

public void
deleteFile(Path
the path of the file to delete
path
)

Implements java.nio.file.SecureDirectoryStream.deleteFile.

Deletes a file.

protected Path
public <V extends FileAttributeView> V
getFileAttributeView(Class<V>
the Class object corresponding to the file attribute view
type
)

Implements java.nio.file.SecureDirectoryStream.getFileAttributeView.

Returns a new file attribute view to access the file attributes of this directory.

public <V extends FileAttributeView> V
getFileAttributeView(Path
the path of the file
path
,
Class<V>
the Class object corresponding to the file attribute view
type
,
LinkOption...
options indicating how symbolic links are handled
options
)

Implements java.nio.file.SecureDirectoryStream.getFileAttributeView.

Returns a new file attribute view to access the file attributes of a file in this directory.

public void
move(Path
the name of the file to move
srcpath
,
SecureDirectoryStream<Path>
the destination directory
targetdir
,
Path
the name to give the file in the destination directory
targetpath
)

Implements java.nio.file.SecureDirectoryStream.move.

Move a file from this directory to another directory.

public SeekableByteChannel
newByteChannel(Path
the 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
)

Implements java.nio.file.SecureDirectoryStream.newByteChannel.

Opens or creates a file in this directory, returning a seekable byte channel to access the file.

public SecureDirectoryStream<Path>
newDirectoryStream(Path
the path to the directory to open
path
,
LinkOption...
options indicating how symbolic links are handled
options
)

Implements java.nio.file.SecureDirectoryStream.newDirectoryStream.

Opens the directory identified by the given path, returning a SecureDirectoryStream to iterate over the entries in the directory.

Inherited from org.apache.sshd.common.file.root.RootedDirectoryStream:
closeiteratorroot

Constructor Detail

RootedSecureDirectoryStreamback to summary
public RootedSecureDirectoryStream(RootedFileSystem rfs, SecureDirectoryStream<Path> delegate)

Method Detail

delegateback to summary
private SecureDirectoryStream<Path> delegate()
deleteDirectoryback to summary
public void deleteDirectory(Path path) 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.

Parameters
path:Path

the path of the directory to delete

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
deleteFileback to summary
public void deleteFile(Path path) 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.

Parameters
path:Path

the path of the file to delete

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

Implements java.nio.file.SecureDirectoryStream.getFileAttributeView.

Doc from java.nio.file.SecureDirectoryStream.getFileAttributeView.

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.

Parameters
<V>
The FileAttributeView type
type:Class<V>

the Class object corresponding to the file attribute view

Returns:V

a new file attribute view of the specified type bound to this directory stream, or null if the attribute view type is not available

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

Implements java.nio.file.SecureDirectoryStream.getFileAttributeView.

Doc from java.nio.file.SecureDirectoryStream.getFileAttributeView.

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.

Parameters
<V>
The FileAttributeView type
path:Path

the path of the file

type:Class<V>

the Class object corresponding to the file attribute view

options:LinkOption[]

options indicating how symbolic links are handled

Returns:V

a new file attribute view of the specified type bound to this directory stream, or null if the attribute view type is not available

Annotations
@Override
moveback to summary
public void move(Path srcpath, SecureDirectoryStream<Path> targetdir, Path targetpath) throws IOException

Implements java.nio.file.SecureDirectoryStream.move.

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

Move a file from this directory to another directory.

This method works in a similar manner to move method when the ATOMIC_MOVE option is specified. That is, this method moves a file as an atomic file system operation. If the srcpath parameter is an absolute path then it locates the source file. If the parameter is a relative path then it is located relative to this open directory. If the targetpath parameter is absolute then it locates the target file (the targetdir parameter is ignored). If the parameter is a relative path it is located relative to the open directory identified by the targetdir parameter. In all cases, if the target file exists then it is implementation specific if it is replaced or this method fails.

Parameters
srcpath:Path

the name of the file to move

targetdir:SecureDirectoryStream<Path>

the destination directory

targetpath:Path

the name to give the file in the destination directory

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
newByteChannelback to summary
public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException

Implements java.nio.file.SecureDirectoryStream.newByteChannel.

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

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 Files.newByteChannel method for the case that the path parameter is an absolute path. When the parameter is a relative path then the file to open or create is relative to this open directory. In addition to the options defined by the Files.newByteChannel method, the NOFOLLOW_LINKS option may be used to ensure that this method fails if the file is a symbolic link.

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.

Parameters
path:Path

the path of the file to open or create

options:Set<? extends OpenOption>

options specifying how the file is opened

attrs:FileAttribute<?>[]

an optional list of attributes to set atomically when creating the file

Returns:SeekableByteChannel

the seekable byte channel

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
newDirectoryStreamback to summary
public SecureDirectoryStream<Path> newDirectoryStream(Path path, LinkOption... options) throws IOException

Implements java.nio.file.SecureDirectoryStream.newDirectoryStream.

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

Opens the directory identified by the given path, returning a SecureDirectoryStream to iterate over the entries in the directory.

This method works in exactly the manner specified by the newDirectoryStream method for the case that the path parameter is an absolute path. When the parameter is a relative path then the directory to open is relative to this open directory. The NOFOLLOW_LINKS option may be used to ensure that this method fails if the file is a symbolic link.

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.

Parameters
path:Path

the path to the directory to open

options:LinkOption[]

options indicating how symbolic links are handled

Returns:SecureDirectoryStream<Path>

a new and open SecureDirectoryStream object

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