public class StorageUtils
extends java.lang.Object
AzureBlobDelete
, AzureBlobDownload
, AzureBlobStreamReader
, AzureBlobStreamWriter
and AzureBlobUpload
.Constructor and Description |
---|
StorageUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
containerExists(com.microsoft.azure.storage.blob.CloudBlobClient cloudBlobClient,
java.lang.String containerName)
Checks if a containers exists with the name given.
|
static java.net.URI |
createContainer(com.microsoft.azure.storage.blob.CloudBlobContainer container)
Creates a container.
|
static javafx.util.Pair<java.util.List,java.util.List> |
getBlobRelativeNames(com.microsoft.azure.storage.blob.CloudBlobContainer cloudBlobContainer,
java.lang.String blobFolderName,
boolean keepBlobName)
Just like
getBlobRelativePaths(com.microsoft.azure.storage.blob.CloudBlobContainer, java.lang.String, java.lang.String, boolean) but instead of returning the local path to store it returns the file name
and blob paths. |
static javafx.util.Pair<java.util.List,java.util.List> |
getBlobRelativeNames(com.microsoft.azure.storage.blob.CloudBlobContainer cloudBlobContainer,
java.lang.String blobFolderName,
boolean keepBlobName,
java.lang.String regex)
Just like
getBlobRelativePaths(com.microsoft.azure.storage.blob.CloudBlobContainer, java.lang.String, java.lang.String, boolean) but instead of returning the local path to store it returns the file name
and blob paths. |
static javafx.util.Pair<java.util.List,java.util.List> |
getBlobRelativePaths(com.microsoft.azure.storage.blob.CloudBlobContainer cloudBlobContainer,
java.lang.String blobFolderName,
java.lang.String folderPath,
boolean keepBlobName)
Get all the blob paths with its respective local paths to save in.
|
static javafx.util.Pair<java.util.List,java.util.List> |
getRelativePaths(java.lang.String folderPath)
Returns the relative path of all the files in an absolute folder path.
|
static java.util.List<java.lang.String> |
listBlobs(com.microsoft.azure.storage.blob.CloudBlobContainer cloudBlobContainer,
java.lang.String blobFolderName)
Lists all the contents in a blob recursively.
|
static java.util.List<java.lang.String> |
listContainers(com.microsoft.azure.storage.blob.CloudBlobClient blobClient)
List all the containers in the account provided.
|
static java.util.List<java.lang.String> |
listContainers(com.microsoft.azure.storage.blob.CloudBlobContainer container)
List all the containers in the account provided.
|
public static java.util.List<java.lang.String> listContainers(com.microsoft.azure.storage.blob.CloudBlobContainer container)
container
- CloudBlobContainer
object.public static java.util.List<java.lang.String> listContainers(com.microsoft.azure.storage.blob.CloudBlobClient blobClient)
blobClient
- CloudBlobClient
object.public static java.net.URI createContainer(com.microsoft.azure.storage.blob.CloudBlobContainer container) throws com.microsoft.azure.storage.StorageException
container
- CloudBlobContainer
object.com.microsoft.azure.storage.StorageException
- If no container is found.public static boolean containerExists(com.microsoft.azure.storage.blob.CloudBlobClient cloudBlobClient, java.lang.String containerName)
cloudBlobClient
- CloudBlobClient
object.containerName
- Name of the container to check.false
if container does not exist, true
otherwise.public static javafx.util.Pair<java.util.List,java.util.List> getRelativePaths(java.lang.String folderPath)
folderPath
- Absolute path of the folder.public static java.util.List<java.lang.String> listBlobs(com.microsoft.azure.storage.blob.CloudBlobContainer cloudBlobContainer, java.lang.String blobFolderName)
cloudBlobContainer
- CloudBlobContainer
object.blobFolderName
- Path to the blob folder.public static javafx.util.Pair<java.util.List,java.util.List> getBlobRelativePaths(com.microsoft.azure.storage.blob.CloudBlobContainer cloudBlobContainer, java.lang.String blobFolderName, java.lang.String folderPath, boolean keepBlobName)
cloudBlobContainer
- CloudBlobContainer
object.blobFolderName
- Blob folder path.folderPath
- Local folder path (where you want to save).keepBlobName
- Keep the root name of the folder.blobPath
and folderFilePath
.public static javafx.util.Pair<java.util.List,java.util.List> getBlobRelativeNames(com.microsoft.azure.storage.blob.CloudBlobContainer cloudBlobContainer, java.lang.String blobFolderName, boolean keepBlobName)
getBlobRelativePaths(com.microsoft.azure.storage.blob.CloudBlobContainer, java.lang.String, java.lang.String, boolean)
but instead of returning the local path to store it returns the file name
and blob paths.cloudBlobContainer
- CloudBlobContainer
object.blobFolderName
- Blob folder path.keepBlobName
- Keep the root name of the folder.blobPath
and folderFilePath
.public static javafx.util.Pair<java.util.List,java.util.List> getBlobRelativeNames(com.microsoft.azure.storage.blob.CloudBlobContainer cloudBlobContainer, java.lang.String blobFolderName, boolean keepBlobName, java.lang.String regex)
getBlobRelativePaths(com.microsoft.azure.storage.blob.CloudBlobContainer, java.lang.String, java.lang.String, boolean)
but instead of returning the local path to store it returns the file name
and blob paths. You can also give a regular expression on the file names to sort what you want.cloudBlobContainer
- CloudBlobContainer
object.blobFolderName
- Blob folder path.keepBlobName
- Keep the root name of the folder.regex
- Regular expression.blobPath
and folderFilePath
.