public abstract class AbstractRepository extends java.lang.Object implements Repository
AbstractRepository is the shared base for implementers of the Repository
interface.RepositoryGSON| Constructor and Description |
|---|
AbstractRepository() |
| Modifier and Type | Method and Description |
|---|---|
java.nio.file.Path |
getCacheDirectory()
Returns the cache directory for the repository.
|
java.nio.file.Path |
getFile(Artifact.Item item,
java.lang.String path)
Returns the path to a file for the item.
|
java.lang.String[] |
listDirectory(Artifact.Item item,
java.lang.String path)
Returns the list of files directly within a specified directory in a zipped directory item.
|
java.io.InputStream |
openStream(Artifact.Item item,
java.lang.String path)
Returns an
InputStream for an item in a repository. |
void |
prepare(Artifact artifact,
ai.djl.util.Progress progress)
Prepares the artifact for use with progress tracking.
|
protected java.net.URI |
resolvePath(Artifact.Item item,
java.lang.String path) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBaseUri, getName, isRemote, locate, newInstance, prepare, resolvepublic java.io.InputStream openStream(Artifact.Item item, java.lang.String path) throws java.io.IOException
InputStream for an item in a repository.openStream in interface Repositoryitem - the item to openpath - the path to a file if the item is a zipped directory. Otherwise, pass nulljava.io.IOException - if it failed to open the streampublic java.lang.String[] listDirectory(Artifact.Item item, java.lang.String path) throws java.io.IOException
listDirectory in interface Repositoryitem - the zipped directory itempath - the path within the zip directoryjava.io.IOException - if it failed to list the directorypublic java.nio.file.Path getFile(Artifact.Item item, java.lang.String path) throws java.io.IOException
getFile in interface Repositoryitem - the item to find the path forpath - the path to a file if the item is a zipped directory. Otherwise, pass nulljava.io.IOException - if it failed to find the pathprotected java.net.URI resolvePath(Artifact.Item item, java.lang.String path) throws java.io.IOException
java.io.IOExceptionpublic void prepare(Artifact artifact, ai.djl.util.Progress progress) throws java.io.IOException
prepare in interface Repositoryartifact - the artifact to prepareprogress - the progress trackerjava.io.IOException - if it failed to preparepublic java.nio.file.Path getCacheDirectory()
throws java.io.IOException
getCacheDirectory in interface Repositoryjava.io.IOException - if it failed to ensure the creation of the cache directory