Package org.scijava.download
Interface LocationCache
-
- All Known Implementing Classes:
DiskLocationCache
public interface LocationCacheAn object which knows how to convert a slow (typically remote)Locationto a faster (typically local) one.- Author:
- Curtis Rueden
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description LocationcachedLocation(Location source)Gets the cache location of a given data source.booleancanCache(Location source)Gets whether the given location can be cached by this cache.StringloadChecksum(Location source)Loads the checksum value which corresponds to the cached location.voidsaveChecksum(Location source, String checksum)Associates the given checksum value with the specified source location.
-
-
-
Method Detail
-
canCache
boolean canCache(Location source)
Gets whether the given location can be cached by this cache.
-
cachedLocation
Location cachedLocation(Location source)
Gets the cache location of a given data source.- Returns:
- A
Locationwhere the source data is, or would be, cached. - Throws:
IllegalArgumentException- if the given source cannot be cached (seecanCache(org.scijava.io.location.Location)).
-
loadChecksum
String loadChecksum(Location source) throws IOException
Loads the checksum value which corresponds to the cached location.- Parameters:
source- The source location for which the cached checksum is desired.- Returns:
- The loaded checksum, or null if one is not available.
- Throws:
IOException- If something goes wrong accessing the checksum.- See Also:
DataHandle.checksum()
-
saveChecksum
void saveChecksum(Location source, String checksum) throws IOException
Associates the given checksum value with the specified source location.- Parameters:
source- The source location for which the checksum should be cached.checksum- The checksum value to cache.- Throws:
IOException- If something goes wrong caching the checksum.- See Also:
DataHandle.checksum()
-
-