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 aFileSystemView
with the stream's directory as its working directory.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
JimfsSecureDirectoryStream.DirectoryIterator
-
Field Summary
Fields Modifier and Type Field Description static java.nio.file.DirectoryStream.Filter<java.lang.Object>
ALWAYS_TRUE_FILTER
A stream filter that always returns true.private FileSystemState
fileSystemState
private java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path>
filter
private java.util.Iterator<java.nio.file.Path>
iterator
private boolean
open
private FileSystemView
view
-
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 void
checkOpen()
private static JimfsPath
checkPath(java.nio.file.Path path)
void
close()
void
deleteDirectory(java.nio.file.Path path)
void
deleteFile(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()
void
move(java.nio.file.Path srcPath, java.nio.file.SecureDirectoryStream<java.nio.file.Path> targetDir, java.nio.file.Path targetPath)
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)
java.nio.file.SecureDirectoryStream<java.nio.file.Path>
newDirectoryStream(java.nio.file.Path path, java.nio.file.LinkOption... options)
private JimfsPath
path()
-
-
-
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:
iterator
in interfacejava.nio.file.DirectoryStream<java.nio.file.Path>
- Specified by:
iterator
in interfacejava.lang.Iterable<java.nio.file.Path>
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in 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:
newDirectoryStream
in 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:
newByteChannel
in 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:
deleteFile
in 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:
deleteDirectory
in 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:
move
in 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:
getFileAttributeView
in 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:
getFileAttributeView
in interfacejava.nio.file.SecureDirectoryStream<java.nio.file.Path>
-
checkPath
private static JimfsPath checkPath(java.nio.file.Path path)
-
-