@Singleton @ThreadSafe @AutoService(value=java.nio.file.spi.FileSystemProvider.class) public final class CloudStorageFileSystemProvider extends FileSystemProvider
FileSystemProvider implementation.
Note: This class should never be used directly. This class is instantiated by the
service loader and called through a standardized API, e.g. Files. However
the javadocs in this class serve as useful documentation for the behavior of the Google Cloud
Storage NIO library.
| Constructor and Description |
|---|
CloudStorageFileSystemProvider()
Default constructor which should only be called by Java SPI.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkAccess(Path path,
AccessMode... modes) |
void |
copy(Path source,
Path target,
CopyOption... options) |
void |
createDirectory(Path dir,
FileAttribute<?>... attrs)
Does nothing since Google Cloud Storage uses fake directories.
|
void |
delete(Path path) |
boolean |
deleteIfExists(Path path) |
boolean |
equals(Object other) |
<V extends FileAttributeView> |
getFileAttributeView(Path path,
Class<V> type,
LinkOption... options) |
FileStore |
getFileStore(Path path)
Throws
UnsupportedOperationException because this feature hasn't been implemented yet. |
CloudStorageFileSystem |
getFileSystem(URI uri)
Returns Cloud Storage file system, provided a URI with no path, e.g.
|
CloudStoragePath |
getPath(URI uri) |
String |
getScheme() |
int |
hashCode() |
boolean |
isHidden(Path path)
Always returns
false, because Google Cloud Storage doesn't support hidden files. |
boolean |
isSameFile(Path path,
Path path2) |
void |
move(Path source,
Path target,
CopyOption... options) |
SeekableByteChannel |
newByteChannel(Path path,
Set<? extends OpenOption> options,
FileAttribute<?>... attrs) |
DirectoryStream<Path> |
newDirectoryStream(Path dir,
DirectoryStream.Filter<? super Path> filter) |
CloudStorageFileSystem |
newFileSystem(URI uri,
Map<String,?> env)
Returns Cloud Storage file system, provided a URI with no path, e.g.
|
InputStream |
newInputStream(Path path,
OpenOption... options) |
<A extends BasicFileAttributes> |
readAttributes(Path path,
Class<A> type,
LinkOption... options) |
Map<String,Object> |
readAttributes(Path path,
String attributes,
LinkOption... options) |
void |
setAttribute(Path path,
String attribute,
Object value,
LinkOption... options)
Throws
UnsupportedOperationException because Cloud Storage objects are immutable. |
static void |
setGCloudOptions(com.google.cloud.storage.StorageOptions newStorageOptions)
Sets options that are only used by the constructor.
|
String |
toString() |
createLink, createSymbolicLink, installedProviders, newAsynchronousFileChannel, newFileChannel, newFileSystem, newOutputStream, readSymbolicLinkpublic CloudStorageFileSystemProvider()
public static void setGCloudOptions(com.google.cloud.storage.StorageOptions newStorageOptions)
public String getScheme()
getScheme in class FileSystemProviderpublic CloudStorageFileSystem getFileSystem(URI uri)
gs://bucket.getFileSystem in class FileSystemProviderpublic CloudStorageFileSystem newFileSystem(URI uri, Map<String,?> env)
gs://bucket.newFileSystem in class FileSystemProvideruri - bucket and current working directory, e.g. gs://bucketenv - map of configuration options, whose keys correspond to the method names of
CloudStorageConfiguration.Builder. However you are not allowed to set the working
directory, as that should be provided in the uriIllegalArgumentException - if uri specifies a user, query, fragment, or scheme is
not public CloudStoragePath getPath(URI uri)
getPath in class FileSystemProviderpublic SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException
newByteChannel in class FileSystemProviderIOExceptionpublic InputStream newInputStream(Path path, OpenOption... options) throws IOException
newInputStream in class FileSystemProviderIOExceptionpublic boolean deleteIfExists(Path path) throws IOException
deleteIfExists in class FileSystemProviderIOExceptionpublic void delete(Path path) throws IOException
delete in class FileSystemProviderIOExceptionpublic void move(Path source, Path target, CopyOption... options) throws IOException
move in class FileSystemProviderIOExceptionpublic void copy(Path source, Path target, CopyOption... options) throws IOException
copy in class FileSystemProviderIOExceptionpublic boolean isSameFile(Path path, Path path2)
isSameFile in class FileSystemProviderpublic boolean isHidden(Path path)
false, because Google Cloud Storage doesn't support hidden files.isHidden in class FileSystemProviderpublic void checkAccess(Path path, AccessMode... modes) throws IOException
checkAccess in class FileSystemProviderIOExceptionpublic <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws IOException
readAttributes in class FileSystemProviderIOExceptionpublic Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options)
readAttributes in class FileSystemProviderpublic <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options)
getFileAttributeView in class FileSystemProviderpublic void createDirectory(Path dir, FileAttribute<?>... attrs)
createDirectory in class FileSystemProviderpublic DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter)
newDirectoryStream in class FileSystemProviderpublic void setAttribute(Path path, String attribute, Object value, LinkOption... options)
UnsupportedOperationException because Cloud Storage objects are immutable.setAttribute in class FileSystemProviderpublic FileStore getFileStore(Path path)
UnsupportedOperationException because this feature hasn't been implemented yet.getFileStore in class FileSystemProviderCopyright © 2016 Google. All rights reserved.