Class StrumpfResolver
- java.lang.Object
-
- org.nd4j.common.resources.strumpf.StrumpfResolver
-
-
Field Summary
Fields Modifier and Type Field Description protected FilecacheDirstatic StringDEFAULT_CACHE_DIRprotected List<String>localResourceDirsstatic StringREF
-
Constructor Summary
Constructors Constructor Description StrumpfResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FileasFile(String resourcePath)Get the specified resources as a standard local file.protected voidassertExists(String resourcePath)InputStreamasStream(String resourcePath)Get the specified resources as an input stream.voidcopyDirectory(String dirPath, File destinationDir)Copy the directory resource (recursively) to the specified destination directorybooleandirectoryExists(String dirPath)Determine if the specified directory resource can be resolved byResolver.copyDirectory(String, File)booleanexists(@NonNull String resourcePath)Determine if the specified file resource can be resolved byResolver.asFile(String)andResolver.asStream(String)booleanhasLocalCache()FilelocalCacheRoot()StringnormalizePath(@NonNull String path)Normalize the path that may be a resource reference.intpriority()Priority of this resolver.
-
-
-
Method Detail
-
priority
public int priority()
Description copied from interface:ResolverPriority of this resolver. 0 is highest priority (check first), larger values are lower priority (check last)
-
exists
public boolean exists(@NonNull @NonNull String resourcePath)Description copied from interface:ResolverDetermine if the specified file resource can be resolved byResolver.asFile(String)andResolver.asStream(String)
-
directoryExists
public boolean directoryExists(String dirPath)
Description copied from interface:ResolverDetermine if the specified directory resource can be resolved byResolver.copyDirectory(String, File)- Specified by:
directoryExistsin interfaceResolver- Parameters:
dirPath- Path of the directory resource to be resolved- Returns:
- True if this resolver is able to resolve the directory - i.e., whether it is a valid path and exists
-
asFile
public File asFile(String resourcePath)
Description copied from interface:ResolverGet the specified resources as a standard local file. Note that the resource must exist as determined byResolver.exists(String)
-
asStream
public InputStream asStream(String resourcePath)
Description copied from interface:ResolverGet the specified resources as an input stream. Note that the resource must exist as determined byResolver.exists(String)
-
copyDirectory
public void copyDirectory(String dirPath, File destinationDir)
Description copied from interface:ResolverCopy the directory resource (recursively) to the specified destination directory- Specified by:
copyDirectoryin interfaceResolver- Parameters:
dirPath- Path of the resource directory to resolvedestinationDir- Where the files should be copied to
-
hasLocalCache
public boolean hasLocalCache()
- Specified by:
hasLocalCachein interfaceResolver- Returns:
- True if the resolver has a local cache directory, as returned by
Resolver.localCacheRoot()
-
localCacheRoot
public File localCacheRoot()
- Specified by:
localCacheRootin interfaceResolver- Returns:
- Root directory of the local cache, or null if
Resolver.hasLocalCache()returns false
-
normalizePath
public String normalizePath(@NonNull @NonNull String path)
Description copied from interface:ResolverNormalize the path that may be a resource reference. For example: "someDir/myFile.zip.resource_reference" --> "someDir/myFile.zip" Returns null if the file cannot be resolved. If the file is not a reference, the original path is returned- Specified by:
normalizePathin interfaceResolver
-
assertExists
protected void assertExists(String resourcePath)
-
-