public final class CloudStoragePath implements Path
A Google Cloud Storage specific implementation of the java.nio.file.Path
interface. An
instance of this class locates an object or a "pseudo-directory" in GCS. This implementation
allows one to use Java's standard file system API to deal with remote objects as if they are
local files.
Example of using java.nio.file.Files
to read all lines from a remote object:
Path path = Paths.get(URI.create("gs://bucket/lolcat.csv"));
List<String> lines = Files.readAllLines(path, StandardCharsets.UTF_8);
Inheritance
Object >
CloudStoragePath
Methods
bucket()
Returns the Cloud Storage bucket name being served by this file system.
Returns
compareTo(Path other)
public int compareTo(Path other)
Parameter
Returns
endsWith(String other)
public boolean endsWith(String other)
Parameter
Returns
endsWith(Path other)
public boolean endsWith(Path other)
Parameter
Returns
equals(Object other)
public boolean equals(Object other)
Parameter
Returns
Overrides
getFileName()
public CloudStoragePath getFileName()
Returns
getFileSystem()
public CloudStorageFileSystem getFileSystem()
Returns
getName(int index)
public CloudStoragePath getName(int index)
Parameter
Returns
getNameCount()
public int getNameCount()
Returns
getParent()
public CloudStoragePath getParent()
Returns
getRoot()
public CloudStoragePath getRoot()
Returns
hashCode()
Returns
Overrides
isAbsolute()
public boolean isAbsolute()
Returns
iterator()
public Iterator<Path> iterator()
Returns
normalize()
public CloudStoragePath normalize()
Returns path without extra slashes or .
and ..
and preserves trailing slash.
Returns
register(WatchService watcher, WatchEvent.Kind<?>[] events)
public WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events)
Parameters
Returns
register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier[] modifiers)
public WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier[] modifiers)
Parameters
Name | Description |
watcher | WatchService
|
events | Kind<?>[]
|
modifiers | java.nio.file.WatchEvent.Modifier[]
|
Returns
relativize(Path object)
public CloudStoragePath relativize(Path object)
Parameter
Name | Description |
object | Path
|
Returns
resolve(String other)
public CloudStoragePath resolve(String other)
Parameter
Returns
resolve(Path object)
public CloudStoragePath resolve(Path object)
Parameter
Name | Description |
object | Path
|
Returns
resolveSibling(String other)
public CloudStoragePath resolveSibling(String other)
Parameter
Returns
resolveSibling(Path other)
public CloudStoragePath resolveSibling(Path other)
Parameter
Returns
startsWith(String other)
public boolean startsWith(String other)
Parameter
Returns
startsWith(Path other)
public boolean startsWith(Path other)
Parameter
Returns
subpath(int beginIndex, int endIndex)
public CloudStoragePath subpath(int beginIndex, int endIndex)
Parameters
Name | Description |
beginIndex | int
|
endIndex | int
|
Returns
toAbsolutePath()
public CloudStoragePath toAbsolutePath()
Returns
toFile()
Returns
toRealPath(LinkOption[] options)
public CloudStoragePath toRealPath(LinkOption[] options)
Returns this path rewritten to the Cloud Storage object name that'd be used to perform i/o.
This method makes path absolute and removes the prefix slash from
the absolute path when stripPrefixSlash is
true
.
Parameter
Name | Description |
options | java.nio.file.LinkOption[]
|
Returns
toString()
Returns
Overrides
toUri()
Returns