public class AssetUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
REMOTE_FILE_NAME_DEFAULT |
| Constructor and Description |
|---|
AssetUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Map<FormParamName,Object> |
assetFormParameters(@NonNull Asset asset)
Extracts form parameters from the provided
Asset. |
static Map<QueryParamName,String> |
assetQueryParameters(@NonNull Asset asset,
@NonNull String experimentKey)
Extracts query parameters from the provided
Asset. |
static RemoteAsset |
createRemoteAsset(@NonNull URI uri,
Optional<String> fileName,
boolean overwrite,
Optional<Map<String,Object>> metadata)
Creates remote asset representation encapsulated into
RemoteAsset instance. |
static Stream<Asset> |
walkFolderAssets(@NonNull File folder,
boolean logFilePath,
boolean recursive,
boolean prefixWithFolderName)
Walks through the asset files in the given folder and produce stream of
Asset objects holding information
about file assets found in the folder. |
public static final String REMOTE_FILE_NAME_DEFAULT
public static Stream<Asset> walkFolderAssets(@NonNull @NonNull File folder, boolean logFilePath, boolean recursive, boolean prefixWithFolderName) throws IOException
Asset objects holding information
about file assets found in the folder.folder - the folder where to look for asset fileslogFilePath - if true the file path relative to the folder will be used.
Otherwise, basename of the asset file will be used.recursive - if true then subfolder files will be included recursively.prefixWithFolderName - if true then path of each asset file will be prefixed with folder name
in case if logFilePath is true.Asset objects.IOException - if an I/O exception occurred.public static RemoteAsset createRemoteAsset(@NonNull @NonNull URI uri, Optional<String> fileName, boolean overwrite, Optional<Map<String,Object>> metadata)
RemoteAsset instance.uri - the URI pointing to the remote asset location. There is no imposed format,
and it could be a private link.fileName - the optional "name" of the remote asset, could be a dataset name, a model file name.overwrite - if true will overwrite all existing assets with the same name.metadata - Some additional data to attach to the remote asset.
The dictionary values must be JSON compatible.RemoteAsset instance.public static Map<QueryParamName,String> assetQueryParameters(@NonNull @NonNull Asset asset, @NonNull @NonNull String experimentKey)
Asset.asset - the Asset to extract HTTP query parameters from.experimentKey - the Experiment key.Copyright © 2021. All rights reserved.