public class StorageUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
StorageUtil.PathInformation |
| Constructor and Description |
|---|
StorageUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
copyAsset(StorageAsset source,
StorageAsset target,
boolean locked,
CopyOption... copyOptions)
Copies the source asset to the target.
|
static void |
copyToLocalFile(StorageAsset asset,
Path destination,
CopyOption... copyOptions) |
static void |
deleteRecursively(StorageAsset baseDir)
Deletes the given asset and all child assets recursively.
|
static StorageUtil.PathInformation |
getAssetDataAsPath(StorageAsset asset) |
static String |
getExtension(StorageAsset asset)
Returns the extension of the name of a given asset.
|
static void |
moveAsset(StorageAsset source,
StorageAsset target,
boolean locked,
CopyOption... copyOptions)
Moves a asset between different storage instances.
|
static void |
recurse(StorageAsset baseAsset,
Consumer<StorageAsset> consumer)
Runs the consumer function recursively on each asset found starting at the base path.
|
static void |
recurse(StorageAsset baseAsset,
Consumer<StorageAsset> consumer,
boolean depthFirst)
Runs the consumer function recursively on each asset found starting at the base path.
|
static void |
recurse(StorageAsset baseAsset,
Consumer<StorageAsset> consumer,
boolean depthFirst,
int maxDepth)
Runs the consumer function recursively on each asset found starting at the base path
|
public StorageUtil()
public static final void copyAsset(StorageAsset source, StorageAsset target, boolean locked, CopyOption... copyOptions) throws IOException
source - The source assettarget - The target assetlocked - If true, a readlock is set on the source and a write lock is set on the target.copyOptions - Copy optionsIOExceptionpublic static final void moveAsset(StorageAsset source, StorageAsset target, boolean locked, CopyOption... copyOptions) throws IOException
source - The source assettarget - The target assetlocked - If true, a lock is used for the move operation.copyOptions - Options for copyingIOException - If the move failspublic static final void recurse(StorageAsset baseAsset, Consumer<StorageAsset> consumer, boolean depthFirst, int maxDepth) throws IOException
baseAsset - The base path where to start searchconsumer - The consumer function applied to each found assetdepthFirst - If true, the deepest elements are consumed first.maxDepth - The maximum depth to recurse into. 0 means, only the baseAsset is consumed, 1 the base asset and its children and so forth.IOExceptionpublic static final void recurse(StorageAsset baseAsset, Consumer<StorageAsset> consumer, boolean depthFirst) throws IOException
baseAsset - The base path where to start searchconsumer - The consumer function applied to each found assetdepthFirst - If true, the deepest elements are consumed first.IOExceptionpublic static final void recurse(StorageAsset baseAsset, Consumer<StorageAsset> consumer) throws IOException
baseAsset - The base path where to start searchconsumer - The consumer function applied to each found assetIOExceptionpublic static final void deleteRecursively(StorageAsset baseDir) throws IOException
baseDir - The base asset to remove.IOExceptionpublic static final String getExtension(StorageAsset asset)
asset - The asset from which to return the extension string.public static final void copyToLocalFile(StorageAsset asset, Path destination, CopyOption... copyOptions) throws IOException
IOExceptionpublic static final StorageUtil.PathInformation getAssetDataAsPath(StorageAsset asset) throws IOException
IOExceptionCopyright © 2006–2019 The Apache Software Foundation. All rights reserved.