Partilhar via


Azure Data Lake Store libraries for Java

Overview

Capture data of any size, type, and ingestion speed in a single place for analytics with Azure Data Lake Store.

To get started with Data Lake Store, see Get started with Azure Data Lake Store using Java.

Client library

Read and write files, set permissions and metadata, and manage files and directories in Data Lake Store with the client library.

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

<dependency>
   <groupId>com.microsoft.azure</groupId>
   <artifactId>azure-data-lake-store-sdk</artifactId>
   <version>2.1.5</version>
</dependency>

Example

Create a Data Lake client from a fully qualified domain name and OAuth2 access token, then create a file in Data Lake and write to it.

// AccessTokenProvider provider = new ClientCredsTokenProvider(authTokenEndpoint, clientId, clientKey);
ADLStoreClient client = ADLStoreClient.createClient(accountFQDN, provider);

// create directory
client.createDirectory("/a/b/w");
        
// create file and write some content
String filename = "/a/b/c.txt";
OutputStream stream = client.createFile(filename, IfExists.OVERWRITE  );
PrintStream out = new PrintStream(stream);
for (int i = 1; i <= 10; i++) {
    out.println("This is line #" + i);
    out.format("This is the same line (%d), but using formatted output. %n", i);
}
out.close();

Management API

Use the management API to manage Data Lake Store accounts, firewall rules, and trusted identity providers.

Add a dependency to your Maven pom.xml file to use the management API in your project.

<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-mgmt-datalake-store</artifactId>
    <version>1.0.0-beta1.3</version>
</dependency>

Samples

Azure Data Lake Get Started

Explore more sample Java code for Azure Data Lake Store you can use in your apps.