Package com.google.common.jimfs
Class JimfsSecureDirectoryStream
- java.lang.Object
-
- com.google.common.jimfs.JimfsSecureDirectoryStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Iterable<java.nio.file.Path>,java.nio.file.DirectoryStream<java.nio.file.Path>,java.nio.file.SecureDirectoryStream<java.nio.file.Path>
final class JimfsSecureDirectoryStream extends java.lang.Object implements java.nio.file.SecureDirectoryStream<java.nio.file.Path>Secure directory stream implementation that uses aFileSystemViewwith the stream's directory as its working directory.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classJimfsSecureDirectoryStream.DirectoryIterator
-
Field Summary
Fields Modifier and Type Field Description static java.nio.file.DirectoryStream.Filter<java.lang.Object>ALWAYS_TRUE_FILTERA stream filter that always returns true.private FileSystemStatefileSystemStateprivate java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path>filterprivate java.util.Iterator<java.nio.file.Path>iteratorprivate booleanopenprivate FileSystemViewview
-
Constructor Summary
Constructors Constructor Description JimfsSecureDirectoryStream(FileSystemView view, java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path> filter, FileSystemState fileSystemState)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckOpen()private static JimfsPathcheckPath(java.nio.file.Path path)voidclose()voiddeleteDirectory(java.nio.file.Path path)voiddeleteFile(java.nio.file.Path path)<V extends java.nio.file.attribute.FileAttributeView>
VgetFileAttributeView(java.lang.Class<V> type)<V extends java.nio.file.attribute.FileAttributeView>
VgetFileAttributeView(java.nio.file.Path path, java.lang.Class<V> type, java.nio.file.LinkOption... options)java.util.Iterator<java.nio.file.Path>iterator()voidmove(java.nio.file.Path srcPath, java.nio.file.SecureDirectoryStream<java.nio.file.Path> targetDir, java.nio.file.Path targetPath)java.nio.channels.SeekableByteChannelnewByteChannel(java.nio.file.Path path, java.util.Set<? extends java.nio.file.OpenOption> options, java.nio.file.attribute.FileAttribute<?>... attrs)java.nio.file.SecureDirectoryStream<java.nio.file.Path>newDirectoryStream(java.nio.file.Path path, java.nio.file.LinkOption... options)private JimfsPathpath()
-
-
-
Field Detail
-
view
private final FileSystemView view
-
filter
private final java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path> filter
-
fileSystemState
private final FileSystemState fileSystemState
-
open
private boolean open
-
iterator
private java.util.Iterator<java.nio.file.Path> iterator
-
ALWAYS_TRUE_FILTER
public static final java.nio.file.DirectoryStream.Filter<java.lang.Object> ALWAYS_TRUE_FILTER
A stream filter that always returns true.
-
-
Constructor Detail
-
JimfsSecureDirectoryStream
public JimfsSecureDirectoryStream(FileSystemView view, java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path> filter, FileSystemState fileSystemState)
-
-
Method Detail
-
path
private JimfsPath path()
-
iterator
public java.util.Iterator<java.nio.file.Path> iterator()
- Specified by:
iteratorin interfacejava.nio.file.DirectoryStream<java.nio.file.Path>- Specified by:
iteratorin interfacejava.lang.Iterable<java.nio.file.Path>
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
checkOpen
protected void checkOpen()
-
newDirectoryStream
public java.nio.file.SecureDirectoryStream<java.nio.file.Path> newDirectoryStream(java.nio.file.Path path, java.nio.file.LinkOption... options) throws java.io.IOException- Specified by:
newDirectoryStreamin interfacejava.nio.file.SecureDirectoryStream<java.nio.file.Path>- Throws:
java.io.IOException
-
newByteChannel
public java.nio.channels.SeekableByteChannel newByteChannel(java.nio.file.Path path, java.util.Set<? extends java.nio.file.OpenOption> options, java.nio.file.attribute.FileAttribute<?>... attrs) throws java.io.IOException- Specified by:
newByteChannelin interfacejava.nio.file.SecureDirectoryStream<java.nio.file.Path>- Throws:
java.io.IOException
-
deleteFile
public void deleteFile(java.nio.file.Path path) throws java.io.IOException- Specified by:
deleteFilein interfacejava.nio.file.SecureDirectoryStream<java.nio.file.Path>- Throws:
java.io.IOException
-
deleteDirectory
public void deleteDirectory(java.nio.file.Path path) throws java.io.IOException- Specified by:
deleteDirectoryin interfacejava.nio.file.SecureDirectoryStream<java.nio.file.Path>- Throws:
java.io.IOException
-
move
public void move(java.nio.file.Path srcPath, java.nio.file.SecureDirectoryStream<java.nio.file.Path> targetDir, java.nio.file.Path targetPath) throws java.io.IOException- Specified by:
movein interfacejava.nio.file.SecureDirectoryStream<java.nio.file.Path>- Throws:
java.io.IOException
-
getFileAttributeView
public <V extends java.nio.file.attribute.FileAttributeView> V getFileAttributeView(java.lang.Class<V> type)
- Specified by:
getFileAttributeViewin interfacejava.nio.file.SecureDirectoryStream<java.nio.file.Path>
-
getFileAttributeView
public <V extends java.nio.file.attribute.FileAttributeView> V getFileAttributeView(java.nio.file.Path path, java.lang.Class<V> type, java.nio.file.LinkOption... options)- Specified by:
getFileAttributeViewin interfacejava.nio.file.SecureDirectoryStream<java.nio.file.Path>
-
checkPath
private static JimfsPath checkPath(java.nio.file.Path path)
-
-