public class AzureBlobStreamWriter
extends java.lang.Object
Constructor and Description |
---|
AzureBlobStreamWriter(java.lang.String accountName,
java.lang.String accountKey,
java.lang.String containerName)
Implements streaming contents to Azure blob containers with HTTPS.
|
AzureBlobStreamWriter(java.lang.String accountName,
java.lang.String accountKey,
java.lang.String containerName,
boolean useHttps)
Implements streaming contents to Azure blob containers.
|
Modifier and Type | Method and Description |
---|---|
java.net.URI |
streamFileWriter(java.lang.String blobPathFileName,
byte[] content)
Writes a file to the blob as a stream.
|
public AzureBlobStreamWriter(java.lang.String accountName, java.lang.String accountKey, java.lang.String containerName)
accountName
- Account name from your Access Keys.accountKey
- Account key from your Access Keys.containerName
- Container name you want to uploadFromFile or create.public AzureBlobStreamWriter(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 java.net.URI streamFileWriter(java.lang.String blobPathFileName, byte[] content) throws java.net.URISyntaxException, com.microsoft.azure.storage.StorageException, java.io.IOException
Example:
AzureBlobStreamWriter streamWriter = new AzureBlobStreamWriter("account name", "account key", "container name");
byte[] someByteArray = new String("some long text).getBytes();
URI uri = streamWriter.streamFileWriter("blob/path/fileName.txt", someByteArray);
blobPathFileName
- Blob path with file name.content
- Can be any content of type byte[]
java.net.URISyntaxException
- If an invalid account name is provided.com.microsoft.azure.storage.StorageException
- Storage error.java.io.IOException
- Used by IOException
.