public class GcsIOChannelFactory extends Object implements IOChannelFactory
| Constructor and Description |
|---|
GcsIOChannelFactory(GcsOptions options) |
| Modifier and Type | Method and Description |
|---|---|
WritableByteChannel |
create(String spec,
String mimeType)
Returns a write channel for the given specification.
|
long |
getSizeBytes(String spec)
Returns the size in bytes for the given specification.
|
boolean |
isReadSeekEfficient(String spec)
Returns
true if the channel created when invoking method IOChannelFactory.open(java.lang.String) for the given
file specification is guaranteed to be of type SeekableByteChannel and if seeking into positions of the channel is recommended. |
Collection<String> |
match(String spec)
Matches a specification, which may contain globs, against available
resources.
|
ReadableByteChannel |
open(String spec)
Returns a read channel for the given specification.
|
String |
resolve(String path,
String other)
Resolve the given
other against the path. |
public GcsIOChannelFactory(GcsOptions options)
public Collection<String> match(String spec) throws IOException
IOChannelFactoryGlob handling is dependent on the implementation. Implementations should all support globs in the final component of a path (eg /foo/bar/*.txt), however they are not required to support globs in the directory paths.
The result is the (possibly empty) set of specifications that match.
match in interface IOChannelFactoryIOExceptionpublic ReadableByteChannel open(String spec) throws IOException
IOChannelFactoryThe specification is not expanded; it is used verbatim.
If seeking is supported, then this returns a
SeekableByteChannel.
open in interface IOChannelFactoryIOExceptionpublic WritableByteChannel create(String spec, String mimeType) throws IOException
IOChannelFactoryThe specification is not expanded; is it used verbatim.
create in interface IOChannelFactoryIOExceptionpublic long getSizeBytes(String spec) throws IOException
IOChannelFactoryThe specification is not expanded; it is used verbatim.
FileNotFoundException will be thrown if the resource does not exist.
getSizeBytes in interface IOChannelFactoryIOExceptionpublic boolean isReadSeekEfficient(String spec) throws IOException
IOChannelFactorytrue if the channel created when invoking method IOChannelFactory.open(java.lang.String) for the given
file specification is guaranteed to be of type SeekableByteChannel and if seeking into positions of the channel is recommended. Returns
false if the channel returned is not a SeekableByteChannel. May return
false even if the channel returned is a SeekableByteChannel, if seeking is not
efficient for the given file specification.
Only efficiently seekable files can be split into offset ranges.
The specification is not expanded; it is used verbatim.
isReadSeekEfficient in interface IOChannelFactoryIOExceptionpublic String resolve(String path, String other) throws IOException
IOChannelFactoryother against the path.
If the other parameter is an absolute path then this method trivially returns other.
If other is an empty path then this method trivially returns the given path.
Otherwise this method considers the given path to be a directory and resolves the
other path against this path. In the simplest case, the other path does not
have a root component, in which case this method joins the other path to the given
path and returns a resulting path that ends with the other path.
Where the other path has a root component then resolution is highly implementation
dependent and therefore unspecified.
resolve in interface IOChannelFactoryIOException