public class CryptoFileSystemProvider extends FileSystemProvider
A FileSystemProvider for CryptoFileSystems.
All FileSystem instances created by CryptoFileSystemProvider are instances of CryptoFileSystem.
Usage
It is recommended to use newFileSystem(Path, CryptoFileSystemProperties) to create a CryptoFileSystem. To do this:
Path storageLocation = Paths.get("/home/cryptobot/vault");
FileSystem fileSystem = CryptoFileSystemProvider.newFileSystem(
storageLocation,
cryptoFileSystemProperties()
.withPassword("password")
.withReadonlyFlag().build());
Afterwards you can use the created FileSystem to create paths, do directory listings, create files and so on.
To create a new FileSystem from a URI using FileSystems.newFileSystem(URI, Map) you may have a look at CryptoFileSystemUri.
| Constructor and Description |
|---|
CryptoFileSystemProvider() |
| Modifier and Type | Method and Description |
|---|---|
static void |
changePassphrase(Path pathToVault,
String masterkeyFilename,
CharSequence oldPassphrase,
CharSequence newPassphrase)
Changes the passphrase of a vault at the given path.
|
void |
checkAccess(Path cleartextPath,
AccessMode... modes) |
static boolean |
containsVault(Path pathToVault,
String masterkeyFilename)
Checks if the folder represented by the given path exists and contains a valid vault structure.
|
void |
copy(Path cleartextSource,
Path cleartextTarget,
CopyOption... options) |
void |
createDirectory(Path cleartextDir,
FileAttribute<?>... attrs) |
void |
delete(Path cleartextPath) |
<V extends FileAttributeView> |
getFileAttributeView(Path cleartextPath,
Class<V> type,
LinkOption... options) |
FileStore |
getFileStore(Path cleartextPath) |
CryptoFileSystem |
getFileSystem(URI uri) |
Path |
getPath(URI uri) |
String |
getScheme() |
static void |
initialize(Path pathToVault,
String masterkeyFilename,
CharSequence passphrase)
Creates a new vault at the given directory path.
|
boolean |
isHidden(Path cleartextPath) |
boolean |
isSameFile(Path cleartextPath,
Path cleartextPath2) |
void |
move(Path cleartextSource,
Path cleartextTarget,
CopyOption... options) |
AsynchronousFileChannel |
newAsynchronousFileChannel(Path cleartextPath,
Set<? extends OpenOption> options,
ExecutorService executor,
FileAttribute<?>... attrs) |
SeekableByteChannel |
newByteChannel(Path cleartextPath,
Set<? extends OpenOption> options,
FileAttribute<?>... attrs) |
DirectoryStream<Path> |
newDirectoryStream(Path cleartextDir,
DirectoryStream.Filter<? super Path> filter) |
FileChannel |
newFileChannel(Path cleartextPath,
Set<? extends OpenOption> optionsSet,
FileAttribute<?>... attrs) |
static CryptoFileSystem |
newFileSystem(Path pathToVault,
CryptoFileSystemProperties properties) |
CryptoFileSystem |
newFileSystem(URI uri,
Map<String,?> rawProperties) |
<A extends BasicFileAttributes> |
readAttributes(Path cleartextPath,
Class<A> type,
LinkOption... options) |
Map<String,Object> |
readAttributes(Path cleartextPath,
String attributes,
LinkOption... options) |
void |
setAttribute(Path cleartextPath,
String attribute,
Object value,
LinkOption... options) |
createLink, createSymbolicLink, deleteIfExists, installedProviders, newFileSystem, newInputStream, newOutputStream, readSymbolicLinkpublic static CryptoFileSystem newFileSystem(Path pathToVault, CryptoFileSystemProperties properties) throws IOException
IOExceptionpublic static void initialize(Path pathToVault, String masterkeyFilename, CharSequence passphrase) throws NotDirectoryException, IOException
pathToVault - Path to a not yet existing directorymasterkeyFilename - Name of the masterkey filepassphrase - Passphrase that should be used to unlock the vaultNotDirectoryException - If the given path is not an existing directory.IOException - If the vault structure could not be initialized due to I/O errorspublic static boolean containsVault(Path pathToVault, String masterkeyFilename)
pathToVault - A directory pathmasterkeyFilename - Name of the masterkey filetrue if the directory seems to contain a vault.public static void changePassphrase(Path pathToVault, String masterkeyFilename, CharSequence oldPassphrase, CharSequence newPassphrase) throws org.cryptomator.cryptolib.api.InvalidPassphraseException, IOException
pathToVault - Vault directorymasterkeyFilename - Name of the masterkey fileoldPassphrase - Current passphrasenewPassphrase - Future passphraseorg.cryptomator.cryptolib.api.InvalidPassphraseException - If oldPassphrase can not be used to unlock the vault.IOException - If the masterkey could not be read or written.public String getScheme()
getScheme in class FileSystemProviderpublic CryptoFileSystem newFileSystem(URI uri, Map<String,?> rawProperties) throws IOException
newFileSystem in class FileSystemProviderIOExceptionpublic CryptoFileSystem getFileSystem(URI uri)
getFileSystem in class FileSystemProviderpublic Path getPath(URI uri)
getPath in class FileSystemProviderpublic AsynchronousFileChannel newAsynchronousFileChannel(Path cleartextPath, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs) throws IOException
newAsynchronousFileChannel in class FileSystemProviderIOExceptionpublic FileChannel newFileChannel(Path cleartextPath, Set<? extends OpenOption> optionsSet, FileAttribute<?>... attrs) throws IOException
newFileChannel in class FileSystemProviderIOExceptionpublic SeekableByteChannel newByteChannel(Path cleartextPath, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException
newByteChannel in class FileSystemProviderIOExceptionpublic DirectoryStream<Path> newDirectoryStream(Path cleartextDir, DirectoryStream.Filter<? super Path> filter) throws IOException
newDirectoryStream in class FileSystemProviderIOExceptionpublic void createDirectory(Path cleartextDir, FileAttribute<?>... attrs) throws IOException
createDirectory in class FileSystemProviderIOExceptionpublic void delete(Path cleartextPath) throws IOException
delete in class FileSystemProviderIOExceptionpublic void copy(Path cleartextSource, Path cleartextTarget, CopyOption... options) throws IOException
copy in class FileSystemProviderIOExceptionpublic void move(Path cleartextSource, Path cleartextTarget, CopyOption... options) throws IOException
move in class FileSystemProviderIOExceptionpublic boolean isSameFile(Path cleartextPath, Path cleartextPath2) throws IOException
isSameFile in class FileSystemProviderIOExceptionpublic boolean isHidden(Path cleartextPath) throws IOException
isHidden in class FileSystemProviderIOExceptionpublic FileStore getFileStore(Path cleartextPath) throws IOException
getFileStore in class FileSystemProviderIOExceptionpublic void checkAccess(Path cleartextPath, AccessMode... modes) throws IOException
checkAccess in class FileSystemProviderIOExceptionpublic <V extends FileAttributeView> V getFileAttributeView(Path cleartextPath, Class<V> type, LinkOption... options)
getFileAttributeView in class FileSystemProviderpublic <A extends BasicFileAttributes> A readAttributes(Path cleartextPath, Class<A> type, LinkOption... options) throws IOException
readAttributes in class FileSystemProviderIOExceptionpublic Map<String,Object> readAttributes(Path cleartextPath, String attributes, LinkOption... options) throws IOException
readAttributes in class FileSystemProviderIOExceptionpublic void setAttribute(Path cleartextPath, String attribute, Object value, LinkOption... options) throws IOException
setAttribute in class FileSystemProviderIOExceptionCopyright © 2017. All rights reserved.