Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package ml.comet.experiment.impl.utils;
import lombok.NonNull;
import lombok.experimental.UtilityClass;
import ml.comet.experiment.asset.Asset;
import ml.comet.experiment.asset.RemoteAsset;
import ml.comet.experiment.impl.asset.AssetImpl;
import ml.comet.experiment.impl.asset.AssetType;
import ml.comet.experiment.impl.asset.RemoteAssetImpl;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Path;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Stream;
import static ml.comet.experiment.impl.asset.AssetType.POINTS_3D;
import static ml.comet.experiment.impl.asset.AssetType.UNKNOWN;
/**
* Utilities to work with assets.
*/
@UtilityClass
public class AssetUtils {
public static final String REMOTE_FILE_NAME_DEFAULT = "remote";
/**
* Walks through the asset files in the given folder and produce stream of {@link Asset} objects holding information
* about file assets found in the folder.
*
* @param folder the folder where to look for asset files
* @param logFilePath if {@code true} the file path relative to the folder will be used.
* Otherwise, basename of the asset file will be used.
* @param recursive if {@code true} then subfolder files will be included recursively.
* @param prefixWithFolderName if {@code true} then path of each asset file will be prefixed with folder name
* in case if {@code logFilePath} is {@code true}.
* @param metadata the optional metadata to associate with assets.
* @param type optional type of the asset (default: ASSET).
* @param groupingName optional name of group the assets should belong.
* @return the stream of {@link AssetImpl} objects.
* @throws IOException if an I/O exception occurred.
*/
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public static Stream walkFolderAssets(
@NonNull File folder, boolean logFilePath, boolean recursive, boolean prefixWithFolderName,
@NonNull Optional