public class AzureBlobUpload
extends java.lang.Object
Constructor and Description |
---|
AzureBlobUpload(java.lang.String accountName,
java.lang.String accountKey,
java.lang.String containerName)
Implements uploading files to Azure blob containers with HTTPS as
true by default. |
AzureBlobUpload(java.lang.String accountName,
java.lang.String accountKey,
java.lang.String containerName,
boolean useHttps)
Implements uploading files to Azure blob containers.
|
Modifier and Type | Method and Description |
---|---|
java.net.URI |
uploadFromFile(java.lang.String pathFileName)
Upload a single file to the root of Azure container.
|
java.net.URI |
uploadFromFile(java.lang.String pathFileName,
java.lang.String blobPath)
Upload a single file to Azure blob and specify the path to the blob folder.
|
java.net.URI |
uploadFromFolder(java.lang.String folderPath)
Do a recursive upload of the folder path provided.
|
java.net.URI |
uploadFromFolder(java.lang.String folderPath,
java.lang.String blobPath)
Do a recursive upload of the folder path provided to a given blob path.
|
public AzureBlobUpload(java.lang.String accountName, java.lang.String accountKey, java.lang.String containerName, boolean useHttps)
accountName
- Account name from your Access Keys.accountKey
- Account key from your Access Keys.containerName
- Container name you want to uploadFromFile or create.useHttps
- true
to use HTTPS to connect to the storage service endpoints;
otherwise, false
. Defaults to true
.public AzureBlobUpload(java.lang.String accountName, java.lang.String accountKey, java.lang.String containerName)
true
by default.accountName
- Account name from your Access Keys.accountKey
- Account key from your Access Keys.containerName
- Container name you want to uploadFromFile or create.public java.net.URI uploadFromFile(java.lang.String pathFileName, java.lang.String blobPath) throws java.net.URISyntaxException, com.microsoft.azure.storage.StorageException, java.io.IOException
Example:
AzureBlobUpload blobUpload = new AzureBlobUpload("account name", "account key", "container name");
URI uri = blobUpload.uploadFromFile("c:/path/to/fileName.txt", "path/to/blob/");
pathFileName
- Absolute path with file name.blobPath
- Path of the blob folder.java.net.URISyntaxException
- If an invalid account name is provided.com.microsoft.azure.storage.StorageException
- Storage error.java.io.IOException
- If the file does not exist.public java.net.URI uploadFromFile(java.lang.String pathFileName) throws java.net.URISyntaxException, com.microsoft.azure.storage.StorageException, java.io.IOException
Example:
AzureBlobUpload blobUpload = new AzureBlobUpload("account name", "account key", "container name");
URI uri = blobUpload.uploadFromFile("c:/path/to/fileName.txt");
pathFileName
- Absolute path with file name.java.net.URISyntaxException
- If an invalid account name is provided.com.microsoft.azure.storage.StorageException
- Storage error.java.io.IOException
- If the file does not exist.public java.net.URI uploadFromFolder(java.lang.String folderPath, java.lang.String blobPath) throws java.net.URISyntaxException, com.microsoft.azure.storage.StorageException, java.io.IOException
Example:
AzureBlobUpload blobUpload = new AzureBlobUpload("account name", "account key", "container name");
URI uri = blobUpload.uploadFromFolder("c:/path/to/", "path/tp/blob/");
folderPath
- Absolute path to a folder.blobPath
- Path of the blob folder.java.net.URISyntaxException
- Is used by CloudStorageAccount
.com.microsoft.azure.storage.StorageException
- If container is not found.java.io.IOException
- If your absolute path contains no file.public java.net.URI uploadFromFolder(java.lang.String folderPath) throws java.net.URISyntaxException, com.microsoft.azure.storage.StorageException, java.io.IOException
Example:
AzureBlobUpload blobUpload = new AzureBlobUpload("account name", "account key", "container name");
URI uri = blobUpload.uploadFromFolder("c:/path/to/");
folderPath
- Absolute path to a folder.java.net.URISyntaxException
- Is used by CloudStorageAccount
.com.microsoft.azure.storage.StorageException
- If container is not found.java.io.IOException
- If your absolute path contains no file.