azure-docs-sdk-java/docs-ref-services/preview/datalake.md

86 строки
2.9 KiB
Markdown
Исходник Постоянная ссылка Обычный вид История

2017-06-23 02:36:10 +03:00
---
title: Azure Data Lake Store libraries for Java
description: Reference documentation for the Java Data Lake Store libraries
2017-06-23 02:36:10 +03:00
keywords: Azure, Java, SDK, API, big data, data lake
ms.date: 06/21/2017
ms.topic: reference
2017-06-23 02:36:10 +03:00
ms.devlang: java
ms.service: data-lake-store
manager: douge
2017-06-23 02:36:10 +03:00
---
# 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](/azure/data-lake-store/data-lake-store-overview).
2017-06-23 02:36:10 +03:00
To get started with Data Lake Store, see [Get started with Azure Data Lake Store using Java](/azure/data-lake-store/data-lake-store-get-started-java-sdk).
2017-06-23 02:36:10 +03:00
## Client library
2017-06-23 02:36:10 +03:00
Read and write files, set permissions and metadata, and manage files and directories in Data Lake Store with the client library.
[Add a dependency](https://maven.apache.org/guides/getting-started/index.html#How_do_I_use_external_dependencies) to your Maven `pom.xml` file to use the client library in your project.
2017-06-23 02:36:10 +03:00
```XML
<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.
2017-06-23 02:36:10 +03:00
```java
// AccessTokenProvider provider = new ClientCredsTokenProvider(authTokenEndpoint, clientId, clientKey);
2017-06-23 02:36:10 +03:00
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();
```
> [!div class="nextstepaction"]
> [Explore the Client APIs](/java/api/overview/azure/datalakestore/client)
## Management API
Use the management API to manage Data Lake Store accounts, firewall rules, and trusted identity providers.
[Add a dependency](https://maven.apache.org/guides/getting-started/index.html#How_do_I_use_external_dependencies) to your Maven `pom.xml` file to use the management API in your project.
```XML
<dependency>
2018-10-18 06:27:41 +03:00
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-mgmt-datalake-store</artifactId>
<version>1.0.0-beta1.3</version>
</dependency>
```
> [!div class="nextstepaction"]
> [Explore the Management APIs](/java/api/overview/azure/datalakestore/management)
2017-06-23 02:36:10 +03:00
## Samples
[Azure Data Lake Get Started][1]
2017-06-23 02:36:10 +03:00
[1]: https://github.com/Azure-Samples/data-lake-store-java-upload-download-get-started
2017-06-23 02:36:10 +03:00
Explore more [sample Java code for Azure Data Lake Store](https://azure.microsoft.com/resources/samples/?platform=java&term=lake) you can use in your apps.