public abstract class PathBasedContentProviderBase extends java.lang.Object implements java.io.Closeable
| Constructor and Description |
|---|
PathBasedContentProviderBase() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
close() |
static PathBasedContentProviderBase |
createProvider(java.io.File file)
Creates a suitable provider for a file.
|
abstract java.util.Collection<java.lang.String> |
getPaths()
Returns the relative paths to all available elements that carry content.
|
java.util.Collection<java.lang.String> |
getPathsWithPrefix(java.lang.String prefix)
Returns all paths starting with a given prefix.
|
abstract java.io.InputStream |
openStream(java.lang.String relativePath)
Opens a stream to the element identified by the given path.
|
public PathBasedContentProviderBase()
public abstract java.util.Collection<java.lang.String> getPaths() throws java.io.IOException
java.io.IOExceptionpublic abstract void close() throws java.io.IOException
This closes the content provider itself, i.e. after closing, no new streams
may be opened. Whether existing streams are closed depends on the
implementation, but it is recommended to close any streams returned from
openStream(String) yourself and to not use any of these streams
after calling this method.
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic abstract java.io.InputStream openStream(java.lang.String relativePath) throws java.io.IOException
getPaths() method. The returned
stream must be closed by the caller.java.io.IOExceptionpublic java.util.Collection<java.lang.String> getPathsWithPrefix(java.lang.String prefix) throws java.io.IOException
java.io.IOExceptionpublic static PathBasedContentProviderBase createProvider(java.io.File file) throws java.io.IOException
java.io.IOException - if accessing the file fails or the file is not of suitable format
(i.e. no directory or ZIP file).