Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Build blob storage applications using the Azure Storage Blob SDK for Java.
.claude/skills/azure-storage-blob-java/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-11 | ✗→✓ | ▲ Improved | — | — |
| case-05 | ✗→✓ | ▲ Improved | — | — |
| case-20 | ✗→✓ | ▲ Improved | — | — |
| case-08 | ✗→✓ | ▲ Improved | — | — |
| case-14 | ✗→✗ | = Same ✗ | — | — |
Build blob storage applications using the Azure Storage Blob SDK for Java.
xml<dependency> <groupId>com.azure</groupId> <artifactId>azure-storage-blob</artifactId> <version>12.33.0</version> </dependency>
javaimport com.azure.storage.blob.BlobServiceClient; import com.azure.storage.blob.BlobServiceClientBuilder; // With SAS token BlobServiceClient serviceClient = new BlobServiceClientBuilder() .endpoint("<storage-account-url>") .sasToken("<sas-token>") .buildClient(); // With connection string BlobServiceClient serviceClient = new BlobServiceClientBuilder() .connectionString("<connection-string>") .buildClient();
javaimport com.azure.identity.DefaultAzureCredentialBuilder; BlobServiceClient serviceClient = new BlobServiceClientBuilder() .endpoint("<storage-account-url>") .credential(new DefaultAzureCredentialBuilder().build()) .buildClient();
javaimport com.azure.storage.blob.BlobContainerClient; // From service client BlobContainerClient containerClient = serviceClient.getBlobContainerClient("mycontainer"); // Direct construction BlobContainerClient containerClient = new BlobContainerClientBuilder() .connectionString("<connection-string>") .containerName("mycontainer") .buildClient();
javaimport com.azure.storage.blob.BlobClient; // From container client BlobClient blobClient = containerClient.getBlobClient("myblob.txt"); // With directory structure BlobClient blobClient = containerClient.getBlobClient("folder/subfolder/myblob.txt"); // Direct construction BlobClient blobClient = new BlobClientBuilder() .connectionString("<connection-string>") .containerName("mycontainer") .blobName("myblob.txt") .buildClient();
java// Create container serviceClient.createBlobContainer("mycontainer"); // Create if not exists BlobContainerClient container = serviceClient.createBlobContainerIfNotExists("mycontainer"); // From container client containerClient.create(); containerClient.createIfNotExists();
javaimport com.azure.core.util.BinaryData; // Upload string String data = "Hello, Azure Blob Storage!"; blobClient.upload(BinaryData.fromString(data)); // Upload with overwrite blobClient.upload(BinaryData.fromString(data), true);
javablobClient.uploadFromFile("local-file.txt"); // With overwrite blobClient.uploadFromFile("local-file.txt", true);
javaimport com.azure.storage.blob.specialized.BlockBlobClient; BlockBlobClient blockBlobClient = blobClient.getBlockBlobClient(); try (ByteArrayInputStream dataStream = new ByteArrayInputStream(data.getBytes())) { blockBlobClient.upload(dataStream, data.length()); }
javaimport com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.options.BlobParallelUploadOptions; BlobHttpHeaders headers = new BlobHttpHeaders() .setContentType("text/plain") .setCacheControl("max-age=3600"); Map<String, String> metadata = Map.of("author", "john", "version", "1.0"); try (InputStream stream = new FileInputStream("large-file.bin")) { BlobParallelUploadOptions options = new BlobParallelUploadOptions(stream) .setHeaders(headers) .setMetadata(metadata); blobClient.uploadWithResponse(options, null, Context.NONE); }
javaimport com.azure.storage.blob.models.BlobRequestConditions; BlobParallelUploadOptions options = new BlobParallelUploadOptions(inputStream, length) .setRequestConditions(new BlobRequestConditions().setIfNoneMatch("*")); blobClient.uploadWithResponse(options, null, Context.NONE);
java// Download to BinaryData BinaryData content = blobClient.downloadContent(); String text = content.toString(); // Download to file blobClient.downloadToFile("downloaded-file.txt");
javatry (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { blobClient.downloadStream(outputStream); byte[] data = outputStream.toByteArray(); }
javaimport com.azure.storage.blob.specialized.BlobInputStream; try (BlobInputStream blobIS = blobClient.openInputStream()) { byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = blobIS.read(buffer)) != -1) { // Process buffer } }
javaimport com.azure.storage.blob.specialized.BlobOutputStream; try (BlobOutputStream blobOS = blobClient.getBlockBlobClient().getBlobOutputStream()) { blobOS.write("Data to upload".getBytes()); }
javaimport com.azure.storage.blob.models.BlobItem; // List all blobs for (BlobItem blobItem : containerClient.listBlobs()) { System.out.println("Blob: " + blobItem.getName()); } // List with prefix (virtual directory) import com.azure.storage.blob.models.ListBlobsOptions; ListBlobsOptions options = new ListBlobsOptions().setPrefix("folder/"); for (BlobItem blobItem : containerClient.listBlobs(options, null)) { System.out.println("Blob: " + blobItem.getName()); }
javaimport com.azure.storage.blob.models.BlobListDetails; String delimiter = "/"; ListBlobsOptions options = new ListBlobsOptions() .setPrefix("data/") .setDetails(new BlobListDetails().setRetrieveMetadata(true)); for (BlobItem item : containerClient.listBlobsByHierarchy(delimiter, options, null)) { if (item.isPrefix()) { System.out.println("Directory: " + item.getName()); } else { System.out.println("Blob: " + item.getName()); } }
javablobClient.delete(); // Delete if exists blobClient.deleteIfExists(); // Delete with snapshots import com.azure.storage.blob.models.DeleteSnapshotsOptionType; blobClient.deleteWithResponse(DeleteSnapshotsOptionType.INCLUDE, null, null, Context.NONE);
javaimport com.azure.storage.blob.models.BlobCopyInfo; import com.azure.core.util.polling.SyncPoller; // Async copy (for large blobs or cross-account) SyncPoller<BlobCopyInfo, Void> poller = blobClient.beginCopy("<source-blob-url>", Duration.ofSeconds(1)); poller.waitForCompletion(); // Sync copy from URL (for same account) blobClient.copyFromUrl("<source-blob-url>");
javaimport com.azure.storage.blob.sas.*; import java.time.OffsetDateTime; // Blob-level SAS BlobSasPermission permissions = new BlobSasPermission().setReadPermission(true); OffsetDateTime expiry = OffsetDateTime.now().plusDays(1); BlobServiceSasSignatureValues sasValues = new BlobServiceSasSignatureValues(expiry, permissions); String sasToken = blobClient.generateSas(sasValues); // Container-level SAS BlobContainerSasPermission containerPermissions = new BlobContainerSasPermission() .setReadPermission(true) .setListPermission(true); BlobServiceSasSignatureValues containerSasValues = new BlobServiceSasSignatureValues(expiry, containerPermissions); String containerSas = containerClient.generateSas(containerSasValues);
javaimport com.azure.storage.blob.models.BlobProperties; // Get properties BlobProperties properties = blobClient.getProperties(); System.out.println("Size: " + properties.getBlobSize()); System.out.println("Content-Type: " + properties.getContentType()); System.out.println("Last Modified: " + properties.getLastModified()); // Set metadata Map<String, String> metadata = Map.of("key1", "value1", "key2", "value2"); blobClient.setMetadata(metadata); // Set HTTP headers BlobHttpHeaders headers = new BlobHttpHeaders() .setContentType("application/json") .setCacheControl("max-age=86400"); blobClient.setHttpHeaders(headers);
javaimport com.azure.storage.blob.specialized.BlobLeaseClient; import com.azure.storage.blob.specialized.BlobLeaseClientBuilder; BlobLeaseClient leaseClient = new BlobLeaseClientBuilder() .blobClient(blobClient) .buildClient(); // Acquire lease (-1 for infinite) String leaseId = leaseClient.acquireLease(60); // Renew lease leaseClient.renewLease(); // Release lease leaseClient.releaseLease();
javaimport com.azure.storage.blob.models.BlobStorageException; try { blobClient.download(outputStream); } catch (BlobStorageException e) { System.out.println("Status: " + e.getStatusCode()); System.out.println("Error code: " + e.getErrorCode()); // 404 = Blob not found // 409 = Conflict (lease, etc.) }
javaimport com.azure.core.http.ProxyOptions; import com.azure.core.http.netty.NettyAsyncHttpClientBuilder; import java.net.InetSocketAddress; ProxyOptions proxyOptions = new ProxyOptions( ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)); BlobServiceClient client = new BlobServiceClientBuilder() .endpoint("<endpoint>") .sasToken("<sas-token>") .httpClient(new NettyAsyncHttpClientBuilder().proxy(proxyOptions).build()) .buildClient();
bashAZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=... AZURE_STORAGE_ACCOUNT_URL=https://<account>.blob.core.windows.net
This skill is applicable to execute the workflow or actions described in the overview.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-11 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +18 percentage points is the difference between those two pass rates over the 22 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.