Package com.massifmaps.utils
Class BundleAssetPackage
java.lang.Object
com.massifmaps.utils.AssetPackage
com.massifmaps.utils.BundleAssetPackage
An asset package based on the assets bundled with the application.
On Android these live inside the APK, where no file path reaches them - which is what
separates this from DirAssetPackage; on iOS and Windows they are the app bundle's own files.
Note: assets and directories with names starting with '.' are ignored.
On Android these live inside the APK, where no file path reaches them - which is what
separates this from DirAssetPackage; on iOS and Windows they are the app bundle's own files.
Note: assets and directories with names starting with '.' are ignored.
-
Constructor Summary
ConstructorsConstructorDescriptionBundleAssetPackage(String basePath) Constructs a bundle asset package rooted at the specified bundled directory.BundleAssetPackage(String basePath, AssetPackage baseAssetPackage) Constructs a bundle asset package rooted at the specified bundled directory, with a
fallback asset package. -
Method Summary
Modifier and TypeMethodDescriptionReturns list of assets in the asset package.
All listed assets can read using loadAsset API.Returns the path of the bundled directory the assets are read from.Returns the list of assets found in the bundle, ignoring the base asset package.Loads the specified asset from the asset package.voidreload()Rescans the bundled directory.Methods inherited from class com.massifmaps.utils.AssetPackage
equals, hashCode
-
Constructor Details
-
BundleAssetPackage
Constructs a bundle asset package rooted at the specified bundled directory.- Parameters:
basePath- The path of the directory inside the bundle, "" for the bundle root.
-
BundleAssetPackage
Constructs a bundle asset package rooted at the specified bundled directory, with a
fallback asset package.- Parameters:
basePath- The path of the directory inside the bundle, "" for the bundle root.baseAssetPackage- The base asset package. If an asset is not found in the bundle, base asset package is used.
-
-
Method Details
-
getBasePath
Returns the path of the bundled directory the assets are read from.- Returns:
- The path of the bundled directory containing the assets.
-
getLocalAssetNames
Returns the list of assets found in the bundle, ignoring the base asset package.- Returns:
- The list of asset names found in the bundle.
-
reload
public void reload()Rescans the bundled directory. Bundled assets do not change while the app runs, so this
only matters when the listing was built before the platform could answer - on Android
the asset manager is connected by the first MapView. -
getAssetNames
Description copied from class:AssetPackageReturns list of assets in the asset package.
All listed assets can read using loadAsset API.- Overrides:
getAssetNamesin classAssetPackage- Returns:
- List of asset names.
-
loadAsset
Description copied from class:AssetPackageLoads the specified asset from the asset package.- Overrides:
loadAssetin classAssetPackage- Parameters:
name- The asset name to read.- Returns:
- Asset data, if the asset exists and was successfully read. Null pointer otherwise.
-