Tabnine Logo
CloudBlobClient.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.microsoft.azure.storage.blob.CloudBlobClient
constructor

Best Java code snippets using com.microsoft.azure.storage.blob.CloudBlobClient.<init> (Showing top 20 results out of 315)

origin: apache/nifi

  String storageConnectionString = String.format(AzureStorageUtils.FORMAT_BASE_URI, accountName);
  StorageCredentials creds = new StorageCredentialsSharedAccessSignature(sasToken);
  cloudBlobClient = new CloudBlobClient(new URI(storageConnectionString), creds);
} else {
  String blobConnString = String.format(AzureStorageUtils.FORMAT_BLOB_CONNECTION_STRING, accountName, accountKey);
origin: stackoverflow.com

 URI BlobEndPoint = new URI("http://127.0.0.1:10000/devstoreaccount1");

CloudBlobClient bClient = new CloudBlobClient(BlobEndPoint, new StorageCredentialsAccountAndKey(AccountName,
        AccountSecurityKey));
origin: org.apache.hadoop/hadoop-azure

@Override
public void createBlobClient(URI baseUri, StorageCredentials credentials) {
 serviceClient = new CloudBlobClient(baseUri, credentials);
 updateRetryPolicy();
 updateTimeoutInMs();
}
origin: stackoverflow.com

 public class SASmeta 
{
public static void main(String[] args) throws URISyntaxException, FileNotFoundException, StorageException, IOException 
  {                        
  URI baseuri = new URI("http://grassy.blob.core.windows.net");
  CloudBlobClient blobclient = new CloudBlobClient(baseuri);
  MyUploadBlob("container1","sr=c&sv=2012-02-12&sig=b%2BK%2FmX8r7dLCVxs5PSPmmji1L6kSxNupp9SKF7yj27w%3D&si=r",blobclient);          
  }

public static void MyUploadBlob(String containerName, String containerSAS, CloudBlobClient blobClient) throws URISyntaxException, StorageException, FileNotFoundException, IOException
  {    
  String blobName = "image1.jpg";  
  String localFileName = "c:\\myimages\\image1.jpg";  
  URI uri = new URI(blobClient.getEndpoint().toString() + "/" + containerName + "/" + blobName + "?" + containerSAS);
  CloudBlockBlob sasBlob = new CloudBlockBlob(uri, blobClient);    
  HashMap<String, String> user = new HashMap<String, String>();    
  user.put("firstname", "Joe");
  user.put("lastname", "Smith" );
  user.put("age", "28");
  user.put("presenter", "no");  
  sasBlob.setMetadata(user);
  File fileReference = new File(localFileName);
  sasBlob.upload(new FileInputStream(fileReference), fileReference.length());
  System.out.println("The blob: " + blobName + " has been uploaded to:");
  System.out.println(uri);
  }
}
origin: com.microsoft.azure/azure-storage

/**
 * Creates a new Blob service client.
 * 
 * @return A {@link CloudBlobClient} that represents the cloud Blob client.
 * 
 */
public CloudBlobClient createCloudBlobClient() {
  if (this.getBlobStorageUri() == null) {
    throw new IllegalArgumentException(SR.BLOB_ENDPOINT_NOT_CONFIGURED);
  }
  if (this.credentials == null) {
    throw new IllegalArgumentException(SR.MISSING_CREDENTIALS);
  }
  return new CloudBlobClient(this.getBlobStorageUri(), this.getCredentials());
}
origin: Azure/azure-storage-android

/**
 * Creates a new Blob service client.
 * 
 * @return A {@link CloudBlobClient} that represents the cloud Blob client.
 * 
 */
public CloudBlobClient createCloudBlobClient() {
  if (this.getBlobStorageUri() == null) {
    throw new IllegalArgumentException(SR.BLOB_ENDPOINT_NOT_CONFIGURED);
  }
  if (this.credentials == null) {
    throw new IllegalArgumentException(SR.MISSING_CREDENTIALS);
  }
  return new CloudBlobClient(this.getBlobStorageUri(), this.getCredentials());
}
origin: Microsoft/azure-tools-for-java

/**
 * Download file from Azure and save to target path specified. Return true if download succeeds
 * @param filePathName
 * @return
 */
private static Boolean downloadFromAzure(@NotNull Path filePathName) {
  boolean result = true;
  try {
    URI cloudBlobUri = new URI(AZURE_BLOB_URI);
    CloudBlobClient serviceClient = new CloudBlobClient(cloudBlobUri);
    CloudBlobContainer container = serviceClient.getContainerReference("libcontainer1");
    CloudBlockBlob blob = container.getBlockBlobReference(filePathName.getFileName().toString());
    File downloadingFile = filePathName.toFile();
    blob.downloadToFile(downloadingFile.getAbsolutePath());
  } catch (Exception e) {
    result = false;
    log.warning("Fail to download file from Azure: " + e.getMessage());
  }
  return result;
}
origin: stackoverflow.com

CloudBlobClient blobclient = new CloudBlobClient(baseuri);
MyDownloadBlob("container1",
 "sr=c&sv=2012-02-12&sig=nnPn5P5nnPPnn5Pnn5PPnPPPnPPP5PPPPPP%5PPnn5PPn%55&si=heath",
origin: stackoverflow.com

CloudBlobClient blobclient = new CloudBlobClient(baseuri);
MyUploadBlob("container1",
 "sr=c&sv=2012-02-12&sig=nnPn5P5nnPPnn5Pnn5PPnPPPnPPP5PPPPPP%5PPnn5PPn%55&si=heath",
origin: com.microsoft.azure/azure-storage

/**
 * Initializes a new instance of the <code>CloudAnalyticsClient</code> class using the specified blob and table
 * service endpoints and account credentials.
 * 
 * @param blobStorageUri
 *            A {@link StorageUri} object containing the Blob service endpoint to use to create the client.
 * @param tableStorageUri
 *            A {@link StorageUri} object containing the Table service endpoint to use to create the client.
 * @param credentials
 *            A {@link StorageCredentials} object.
 */
public CloudAnalyticsClient(StorageUri blobStorageUri, StorageUri tableStorageUri, StorageCredentials credentials) {
  Utility.assertNotNull("blobStorageUri", blobStorageUri);
  Utility.assertNotNull("tableStorageUri", tableStorageUri);
  this.blobClient = new CloudBlobClient(blobStorageUri, credentials);
  this.tableClient = new CloudTableClient(tableStorageUri, credentials);
}
origin: Azure/azure-storage-android

/**
 * Initializes a new instance of the <code>CloudAnalyticsClient</code> class using the specified blob and table
 * service endpoints and account credentials.
 * 
 * @param blobStorageUri
 *            A {@link StorageUri} object containing the Blob service endpoint to use to create the client.
 * @param tableStorageUri
 *            A {@link StorageUri} object containing the Table service endpoint to use to create the client.
 * @param credentials
 *            A {@link StorageCredentials} object.
 */
public CloudAnalyticsClient(StorageUri blobStorageUri, StorageUri tableStorageUri, StorageCredentials credentials) {
  Utility.assertNotNull("blobStorageUri", blobStorageUri);
  Utility.assertNotNull("tableStorageUri", tableStorageUri);
  this.blobClient = new CloudBlobClient(blobStorageUri, credentials);
  this.tableClient = new CloudTableClient(tableStorageUri, credentials);
}
origin: iterate-ch/cyberduck

final CloudBlobClient client = new CloudBlobClient(uri, credentials);
client.setDirectoryDelimiter(String.valueOf(Path.DELIMITER));
final BlobRequestOptions options = new BlobRequestOptions();
origin: Azure/azure-storage-android

this.blobServiceClient = new CloudBlobClient(PathUtility.getServiceClientBaseAddress(
    this.getStorageUri(), usePathStyleUris), credentials != null ? credentials : parsedCredentials);
this.name = PathUtility.getBlobNameFromURI(this.storageUri.getPrimaryUri(), usePathStyleUris);
origin: com.microsoft.azure/azure-storage

this.blobServiceClient = new CloudBlobClient(PathUtility.getServiceClientBaseAddress(
    this.getStorageUri(), usePathStyleUris), credentials != null ? credentials : parsedCredentials);
this.name = PathUtility.getContainerNameFromUri(this.storageUri.getPrimaryUri(), usePathStyleUris);
origin: Azure/azure-storage-android

this.blobServiceClient = new CloudBlobClient(PathUtility.getServiceClientBaseAddress(
    this.getStorageUri(), usePathStyleUris), credentials != null ? credentials : parsedCredentials);
this.name = PathUtility.getContainerNameFromUri(this.storageUri.getPrimaryUri(), usePathStyleUris);
origin: com.microsoft.azure/azure-storage

this.blobServiceClient = new CloudBlobClient(PathUtility.getServiceClientBaseAddress(
    this.getStorageUri(), usePathStyleUris), credentials != null ? credentials : parsedCredentials);
this.name = PathUtility.getBlobNameFromURI(this.storageUri.getPrimaryUri(), usePathStyleUris);
origin: Azure/azure-storage-android

@Test
@Category(SlowTests.class)
public void testBlobSaS() throws InvalidKeyException, IllegalArgumentException, StorageException,
    URISyntaxException, InterruptedException {
  SharedAccessBlobPolicy sp = createSharedAccessPolicy(
      EnumSet.of(SharedAccessBlobPermissions.READ, SharedAccessBlobPermissions.LIST), 3600);
  BlobContainerPermissions perms = new BlobContainerPermissions();
  perms.getSharedAccessPolicies().put("readperm", sp);
  this.container.uploadPermissions(perms);
  Thread.sleep(30000);
  CloudBlockBlob sasBlob = new CloudBlockBlob(new URI(this.blob.getUri().toString() + "?"
      + this.blob.generateSharedAccessSignature(null, "readperm")));
  sasBlob.download(new ByteArrayOutputStream());
  // do not give the client and check that the new blob's client has the correct perms
  CloudBlob blobFromUri = new CloudBlockBlob(PathUtility.addToQuery(this.blob.getStorageUri(),
      this.blob.generateSharedAccessSignature(null, "readperm")));
  assertEquals(StorageCredentialsSharedAccessSignature.class.toString(), blobFromUri.getServiceClient()
      .getCredentials().getClass().toString());
  // create credentials from sas
  StorageCredentials creds = new StorageCredentialsSharedAccessSignature(
      this.blob.generateSharedAccessSignature(null, "readperm"));
  CloudBlobClient bClient = new CloudBlobClient(sasBlob.getServiceClient().getStorageUri(), creds);
  CloudBlockBlob blobFromClient = bClient.getContainerReference(this.blob.getContainer().getName())
      .getBlockBlobReference(this.blob.getName());
  assertEquals(StorageCredentialsSharedAccessSignature.class.toString(), blobFromClient.getServiceClient()
      .getCredentials().getClass().toString());
  assertEquals(bClient, blobFromClient.getServiceClient());
}
origin: Azure/azure-storage-android

CloudBlobClient bClient = new CloudBlobClient(this.container.getServiceClient().getStorageUri(), creds);
origin: Azure/azure-storage-android

@Test
public void testLocationModeWithMissingUri() throws URISyntaxException, StorageException {
  CloudBlobClient client = TestHelper.createCloudBlobClient();
  CloudBlobClient primaryOnlyClient = new CloudBlobClient(client.getEndpoint(), client.getCredentials());
  CloudBlobContainer container = primaryOnlyClient.getContainerReference("nonexistingcontainer");
origin: Azure/azure-storage-android

    new URI("http://" + ACCOUNT_NAME + SECONDARY_SUFFIX + BLOB_SERVICE + ENDPOINT_SUFFIX));
CloudBlobClient client = new CloudBlobClient(endpoint, blobClient.getCredentials());
assertEquals(endpoint, client.getStorageUri());
assertEquals(endpoint.getPrimaryUri(), client.getEndpoint());
com.microsoft.azure.storage.blobCloudBlobClient<init>

Javadoc

Creates an instance of the CloudBlobClient class using the specified Blob service endpoint and anonymous credentials.

Popular methods of CloudBlobClient

  • getContainerReference
    Gets a CloudBlobContainer object with the specified name.
  • listContainers
    Returns an enumerable collection of blob containers whose names begin with the specified prefix for
  • getDefaultRequestOptions
    Gets the BlobRequestOptions that is used for requests associated with this CloudBlobClient
  • getCredentials
  • downloadServiceProperties
    Retrieves the current ServiceProperties for the given storage service. This includes Logging, HourMe
  • uploadServiceProperties
    Uploads a new ServiceProperties configuration to the given storage service. This includes Logging, H
  • listContainersSegmented
    Returns a result segment of an enumerable collection of blob containers whose names begin with the s
  • getDirectoryDelimiter
    Returns the value for the default delimiter used for cloud blob directories. The default is '/'.
  • getServiceStats
    Queries the given storage service for the ServiceStats.
  • getStorageUri
  • setDefaultRequestOptions
    Sets the BlobRequestOptions that is used for any requests associated with this CloudBlobClient objec
  • downloadServicePropertiesImpl
  • setDefaultRequestOptions,
  • downloadServicePropertiesImpl,
  • getEndpoint,
  • getServiceStatsImpl,
  • isUsePathStyleUris,
  • listContainersWithPrefix,
  • listContainersWithPrefixSegmented,
  • listContainersWithPrefixSegmentedImpl,
  • setDirectoryDelimiter

Popular in Java

  • Running tasks concurrently on multiple threads
  • onRequestPermissionsResult (Fragment)
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now