Package ai.djl.repository
Class AbstractRepository
java.lang.Object
ai.djl.repository.AbstractRepository
- All Implemented Interfaces:
- Repository
- Direct Known Subclasses:
- JarRepository,- LocalRepository,- RemoteRepository,- SimpleRepository,- SimpleUrlRepository
The 
AbstractRepository is the shared base for implementers of the Repository
 interface.- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddResource(MRL mrl) Adds resource to the repository.protected voiddownload(Path tmp, URI baseUri, Artifact.Item item, ai.djl.util.Progress progress) Returns the URI to the base of the repository.Returns the cache directory for the repository.getFile(Artifact.Item item, String path) Returns the path to a file for the item.getName()Returns the repository name.String[]listDirectory(Artifact.Item item, String path) Returns the list of files directly within a specified directory in a zipped directory item.openStream(Artifact.Item item, String path) Returns anInputStreamfor an item in a repository.voidPrepares the artifact for use with progress tracking.protected URIresolvePath(Artifact.Item item, String path) protected voidsave(InputStream is, Path tmp, Artifact.Item item, ai.djl.util.Progress progress) Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ai.djl.repository.Repositorydataset, dataset, getResourceDirectory, getResources, isRemote, locate, model, model, model, prepare, resolve
- 
Field Details- 
name
- 
uri
- 
arguments
 
- 
- 
Constructor Details- 
AbstractRepository
 
- 
- 
Method Details- 
getNameReturns the repository name.- Specified by:
- getNamein interface- Repository
- Returns:
- the repository name
 
- 
getBaseUriReturns the URI to the base of the repository.- Specified by:
- getBaseUriin interface- Repository
- Returns:
- the URI
 
- 
openStreamReturns anInputStreamfor an item in a repository.- Specified by:
- openStreamin interface- Repository
- Parameters:
- item- the item to open
- path- the path to a file if the item is a zipped directory. Otherwise, pass null
- Returns:
- the file stream
- Throws:
- IOException- if it failed to open the stream
 
- 
listDirectoryReturns the list of files directly within a specified directory in a zipped directory item.- Specified by:
- listDirectoryin interface- Repository
- Parameters:
- item- the zipped directory item
- path- the path within the zip directory
- Returns:
- the list of files/directories
- Throws:
- IOException- if it failed to list the directory
 
- 
getFileReturns the path to a file for the item.- Specified by:
- getFilein interface- Repository
- Parameters:
- item- the item to find the path for
- path- the path to a file if the item is a zipped directory. Otherwise, pass null
- Returns:
- the file path
- Throws:
- IOException- if it failed to find the path
 
- 
resolvePath- Throws:
- IOException
 
- 
preparePrepares the artifact for use with progress tracking.- Specified by:
- preparein interface- Repository
- Parameters:
- artifact- the artifact to prepare
- progress- the progress tracker
- Throws:
- IOException- if it failed to prepare
 
- 
getCacheDirectoryReturns the cache directory for the repository.- Specified by:
- getCacheDirectoryin interface- Repository
- Returns:
- the cache directory path
- Throws:
- IOException- if it failed to ensure the creation of the cache directory
 
- 
addResourceAdds resource to the repository.- Specified by:
- addResourcein interface- Repository
- Parameters:
- mrl- the resource to add
 
- 
downloadprotected void download(Path tmp, URI baseUri, Artifact.Item item, ai.djl.util.Progress progress) throws IOException - Throws:
- IOException
 
- 
saveprotected void save(InputStream is, Path tmp, Artifact.Item item, ai.djl.util.Progress progress) throws IOException - Throws:
- IOException
 
 
-