Hướng dẫn add library sdk rdvideoeditsdk

Chuyển đến nội dung chính

Trình duyệt này không còn được hỗ trợ nữa.

Hãy nâng cấp lên Microsoft Edge để tận dụng các tính năng mới nhất, bản cập nhật bảo mật và hỗ trợ kỹ thuật.

Azure Storage libraries for Java

  • Bài viết
  • 10/05/2022
  • 2 phút để đọc

Trong bài viết này

The Azure Storage libraries for Java provide classes for working with data in your your Azure storage account, and with the storage account itself. For more information about Azure Storage, see Introduction to Azure Storage.

Client library for data access

The Azure Storage client library for Java supports Blob storage, Queue storage, Azure Files, and Azure Data Lake Storage Gen2 [preview library].

Add the package to your project

Add the following dependencies to your Maven pom.xml file as appropriate:


    com.azure
    azure-storage-blob
    12.4.0



  com.azure
  azure-storage-queue
  12.3.0



  com.azure
  azure-storage-file-share
  12.2.0



  com.azure
  azure-storage-file-datalake
  12.0.0-preview.6

For more information about adding a dependency in Java, see Add a dependency.

Example usage

The following example creates a storage container and uploads a local file to the storage container.

String yourSasToken = "";
/* Create a new BlobServiceClient with a SAS Token */
BlobServiceClient blobServiceClient = new BlobServiceClientBuilder[]
    .endpoint["//your-storage-account-url.storage.windows.net"]
    .sasToken[yourSasToken]
    .buildClient[];

/* Create a new container client */
try {
    containerClient = blobServiceClient.createBlobContainer["my-container-name"];
} catch [BlobStorageException ex] {
    // The container may already exist, so don't throw an error
    if [!ex.getErrorCode[].equals[BlobErrorCode.CONTAINER_ALREADY_EXISTS]] {
        throw ex;
    }
}

/* Upload the file to the container */
BlobClient blobClient = containerClient.getBlobClient["my-remote-file.jpg"];
blobClient.uploadFromFile["my-local-file.jpg"];

For more examples, review the Client Library README.

Available packages

The following table describes the recommended versions of the storage client library for Java.

Library versionSupported servicesMavenReference / JavadocSource, Readme, Examples
Version 12 Blob, Queue, File, and Data Lake Blob
Queue
File
Data Lake
Blob
Queue
File
Data Lake
Blob [Quickstart]
Queue
File
Data Lake
Version 8 Blob, Queue, File, and Table All services Version 8 reference All services [Quickstart]

Refer to the Azure SDK Releases page for details on how to install and use the preview packages.

Client library for resource management

Use the Azure Storage resource provider to manage storage accounts, account keys, access tiers, and more. To use the resource provider library, add a dependency to your Maven pom.xml file. The latest version of the resource provider library is available on Maven.

For more information about the resource provider library, see the Management reference. The source code for the resource provider library is available in the Azure Java SDK repository.

The following example creates a new storage account in your subscription and retrieves its access keys.

StorageAccount storageAccount = azure.storageAccounts[].define[storageAccountName]
        .withRegion[Region.US_EAST]
        .withNewResourceGroup[rgName]
        .create[];

// get a list of storage account keys related to the account
List storageAccountKeys = storageAccount.getKeys[];
for[StorageAccountKey key : storageAccountKeys]    {
    System.out.println["Key name: " + key.keyName[] + " with value "+ key.value[]];
}

Phản hồi

Gửi và xem ý kiến phản hồi dành cho

주요 콘텐츠로 건너뛰기

이 브라우저는 더 이상 지원되지 않습니다.

최신 기능, 보안 업데이트, 기술 지원을 이용하려면 Microsoft Edge로 업그레이드하세요.

Azure IoT libraries for Java

  • 아티클
  • 10/05/2022
  • 읽는 데 2분 걸림

이 문서의 내용

Connect, monitor, and control Internet of Things assets with Azure IoT Hub.

To get started with Azure IoT Hub, see Connect your device to your IoT hub using Java.

IoT Service library

Register devices and send messages from the cloud to registered devices using the IoT Service library.

Add a dependency to your Maven pom.xml file to use the client library in your project.


    com.microsoft.azure.sdk.iot
    iot-service-client
    1.6.23

IoT Device library

Send messages to the cloud and receive messages on devices using the IoT Device library.

Add a dependency to your Maven pom.xml file to use the client library in your project.


    com.microsoft.azure.sdk.iot
    iot-device-client
    1.3.31

Example

Send a message from Azure IoT Hub to a device.

Message messageToSend = new Message[messageText];
messageToSend.setDeliveryAcknowledgement[DeliveryAcknowledgement.Full];
messageToSend.setMessageId[java.util.UUID.randomUUID[].toString[]];

// set message properties
Map propertiesToSend = new HashMap[];
propertiesToSend.put[messagePropertyKey,messagePropertyKey];
messageToSend.setProperties[propertiesToSend];

CompletableFuture future = serviceClient.sendAsync[deviceId, messageToSend];
try {
    future.get[];
}
catch [ExecutionException e] {
    System.out.println["Exception : " + e.getMessage[]];
}

Samples

IoT Device samples
IoT Service samples

Explore more sample Java code for Azure IoT you can use in your apps.

피드백

Chủ Đề