public interface IOChannelFactory
Channels provide an abstract API for IO operations.
| 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 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. |
Collection<String> match(String spec) throws IOException
Glob 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.
IOExceptionReadableByteChannel open(String spec) throws IOException
The specification is not expanded; it is used verbatim.
If seeking is supported, then this returns a
SeekableByteChannel.
IOExceptionWritableByteChannel create(String spec, String mimeType) throws IOException
The specification is not expanded; is it used verbatim.
IOExceptionlong getSizeBytes(String spec) throws IOException
The specification is not expanded; it is used verbatim.
FileNotFoundException will be thrown if the resource does not exist.
IOExceptionboolean isReadSeekEfficient(String spec) throws IOException
true if the channel created when invoking method 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.
IOExceptionString resolve(String path, String other) throws IOException
other 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.
IOException