Package io.anyline2
Class AssetUtilImpl
-
- All Implemented Interfaces:
-
io.anyline2.AssetUtil
public class AssetUtilImpl implements AssetUtil
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringSCHEMAS_PATHpublic final static StringBARCODE_PATHpublic final static StringMETER_PATHpublic final static StringID_PATHpublic final static StringLICENSE_PLATE_PATHpublic final static StringANYLINE_OCR_PATHpublic final static StringANYLINE_TIRE_PATHpublic final static StringASSETS_JSON_FILE_NAMEpublic final static StringANYLINE_COMMON_FUNCTIONS_PATH
-
Constructor Summary
Constructors Constructor Description AssetUtilImpl()
-
Method Summary
Modifier and Type Method Description static voidcopyAssetFileWithoutPath(Context context, String pathInAssets, File dirToCopyTo, boolean isForceCopy)Copy the asset file specified by path directly to the given directory (without the relative path of the asset). static voidcopyAssetFileWithoutPath(Context context, String pathInAssets, File dirToCopyTo, String shaHash)Copy the asset file specified by path directly to the given directory (without the relative path of the asset). static booleanassetExists(Context context, String path)StringgetAssetPathForPlugin(@NonNull() Context context, @NonNull() PluginType pluginType)-
-
Method Detail
-
copyAssetFileWithoutPath
static void copyAssetFileWithoutPath(Context context, String pathInAssets, File dirToCopyTo, boolean isForceCopy)
Copy the asset file specified by path directly to the given directory (without the relative path of the asset).
SHA sum will be calculated and stored to the target dir with .sha ending. Calculating this takes time, prefer auto generating the anyline_assets.json or providing the SHA with copyAssetFileWithoutPath.
If isForceCopy is false, this will not copy anything if the same .sha file is in the target dir.
- Parameters:
context- the contextpathInAssets- Path to asset, relative to app's assets directory.dirToCopyTo- the target directoryisForceCopy- if true the file will always be copied (an sha will be calculated and checked otherwise)
-
copyAssetFileWithoutPath
static void copyAssetFileWithoutPath(Context context, String pathInAssets, File dirToCopyTo, String shaHash)
Copy the asset file specified by path directly to the given directory (without the relative path of the asset).
The file will only be copied if it does not exist in the target location, or the saved sha for that file is different to the one given. (The file will always be copied if the given hash is null)
- Parameters:
context- the contextpathInAssets- Path to asset, relative to app's assets directory.dirToCopyTo- the target directoryshaHash- the SHA checksum for the file to copy
-
assetExists
static boolean assetExists(Context context, String path)
-
getAssetPathForPlugin
@Nullable() String getAssetPathForPlugin(@NonNull() Context context, @NonNull() PluginType pluginType)
-
-
-
-