Package aQute.libg.shacache
Class ShaCache
- java.lang.Object
-
- aQute.libg.shacache.ShaCache
-
public class ShaCache extends java.lang.ObjectProvide a standardized cache based on the SHA-1 of a file.
-
-
Constructor Summary
Constructors Constructor Description ShaCache(java.io.File root)Create a SHA-1 cache on a directory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.FilegetFile(java.lang.String sha, ShaSource... sources)Small variation on the cache that returns a file instead of a streamjava.io.FilegetRoot()Get the root to the cachejava.io.InputStreamgetStream(java.lang.String sha, ShaSource... sources)Return a stream that is associated with a SHA.voidpurge()Clean the cache
-
-
-
Method Detail
-
getStream
public java.io.InputStream getStream(java.lang.String sha, ShaSource... sources) throws java.lang.ExceptionReturn a stream that is associated with a SHA. If the SHA is not in the local cache, the given sources parameter can specify a way to get the content.- Parameters:
sha- the shasources- objects that can retrieve the original data- Returns:
- the stream or null if not found.
- Throws:
java.lang.Exception
-
getFile
public java.io.File getFile(java.lang.String sha, ShaSource... sources) throws java.lang.ExceptionSmall variation on the cache that returns a file instead of a stream- Parameters:
sha- the SHA-1sources- the inputs- Returns:
- a file or null
- Throws:
java.lang.Exception
-
purge
public void purge() throws java.lang.ExceptionClean the cache- Throws:
java.lang.Exception
-
getRoot
public java.io.File getRoot()
Get the root to the cache
-
-