DataLakeFileClient クラス

public class DataLakeFileClient
extends DataLakePathClient

このクラスは、Azure Storage Data Lake のファイル操作を含むクライアントを提供します。 このクライアントによって提供される操作には、ファイルの作成、ファイルの削除、ファイルの名前変更、メタデータと http ヘッダーの設定、アクセス制御の設定と取得、プロパティの取得、ファイルの読み取り、ファイルへの書き込みデータの追加とフラッシュが含まれます。

このクライアントは を介して DataLakePathClientBuilder インスタンス化されるか、 を介して getFileClient(String fileName)取得されます。

詳細については、 Azure Docs を参照してください。

メソッドの概要

修飾子と型 メソッドと説明
void append(BinaryData data, long fileOffset)

後で flush の呼び出しによってフラッシュ (書き込まれる) されるように、指定されたリソースにデータを追加します

void append(InputStream data, long fileOffset, long length)

後で flush の呼び出しによってフラッシュ (書き込まれる) されるように、指定されたリソースにデータを追加します

Response<Void> appendWithResponse(BinaryData data, long fileOffset, byte[] contentMd5, String leaseId, Duration timeout, Context context)

後で flush の呼び出しによってフラッシュ (書き込まれる) されるように、指定されたリソースにデータを追加します

Response<Void> appendWithResponse(BinaryData data, long fileOffset, DataLakeFileAppendOptions appendOptions, Duration timeout, Context context)

後で flush の呼び出しによってフラッシュ (書き込まれる) されるように、指定されたリソースにデータを追加します

Response<Void> appendWithResponse(InputStream data, long fileOffset, long length, byte[] contentMd5, String leaseId, Duration timeout, Context context)

後で flush の呼び出しによってフラッシュ (書き込まれる) されるように、指定されたリソースにデータを追加します

Response<Void> appendWithResponse(InputStream data, long fileOffset, long length, DataLakeFileAppendOptions appendOptions, Duration timeout, Context context)

後で flush の呼び出しによってフラッシュ (書き込まれる) されるように、指定されたリソースにデータを追加します

void delete()

ファイルを削除します。

boolean deleteIfExists()

ファイルが存在する場合は削除します。

Response<Boolean> deleteIfExistsWithResponse(DataLakePathDeleteOptions options, Duration timeout, Context context)

ファイルが存在する場合は削除します。

Response<Void> deleteWithResponse(DataLakeRequestConditions requestConditions, Duration timeout, Context context)

ファイルを削除します。

PathInfo flush(long position)

非推奨

代わりに、「flush(long position, boolean overwrite)」を参照してください。

以前にファイルに追加されたデータを、追加する呼び出しを通じてフラッシュ (書き込み) します。

PathInfo flush(long position, boolean overwrite)

追加する呼び出しを通じて、以前にファイルに追加されたデータをフラッシュ (書き込み) します。

Response<PathInfo> flushWithResponse(long position, boolean retainUncommittedData, boolean close, PathHttpHeaders httpHeaders, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

追加する呼び出しを通じて、以前にファイルに追加されたデータをフラッシュ (書き込み) します。

Response<PathInfo> flushWithResponse(long position, DataLakeFileFlushOptions flushOptions, Duration timeout, Context context)

追加する呼び出しを通じて、以前にファイルに追加されたデータをフラッシュ (書き込み) します。

DataLakeFileClient getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey)

指定した DataLakeFileClient を使用して、新しい customerProvidedKey を作成します。

String getFileName()

完全なパスを含まない、このファイルの名前を取得します。

String getFilePath()

リソース自体の名前を含まない、このファイルのパスを取得します。

String getFileUrl()

Data Lake サービスでこのクライアントによって表されるファイルの URL を取得します。

OutputStream getOutputStream()

ファイルにデータを書き込む出力ストリームを作成して開きます。

OutputStream getOutputStream(DataLakeFileOutputStreamOptions options)

ファイルにデータを書き込む出力ストリームを作成して開きます。

OutputStream getOutputStream(DataLakeFileOutputStreamOptions options, Context context)

ファイルにデータを書き込む出力ストリームを作成して開きます。

DataLakeFileOpenInputStreamResult openInputStream()

ファイル入力ストリームを開き、ファイルをダウンロードします。

DataLakeFileOpenInputStreamResult openInputStream(DataLakeFileInputStreamOptions options)

ファイル入力ストリームを開き、指定した範囲のファイルをダウンロードします。

DataLakeFileOpenInputStreamResult openInputStream(DataLakeFileInputStreamOptions options, Context context)

ファイル入力ストリームを開き、指定した範囲のファイルをダウンロードします。

InputStream openQueryInputStream(String expression)

入力ストリームを開き、ファイルに対してクエリを実行します。

Response<InputStream> openQueryInputStreamWithResponse(FileQueryOptions queryOptions)

入力ストリームを開き、ファイルに対してクエリを実行します。

void query(OutputStream stream, String expression)

ファイル全体を出力ストリームに照会します。

FileQueryResponse queryWithResponse(FileQueryOptions queryOptions, Duration timeout, Context context)

ファイル全体を出力ストリームに照会します。

void read(OutputStream stream)

ファイル全体を出力ストリームに読み取ります。

PathProperties readToFile(String filePath)

パスで指定されたファイルにファイル全体を読み取ります。

PathProperties readToFile(String filePath, boolean overwrite)

パスで指定されたファイルにファイル全体を読み取ります。

Response<PathProperties> readToFileWithResponse(String filePath, FileRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, DataLakeRequestConditions requestConditions, boolean rangeGetContentMd5, Set<OpenOption> openOptions, Duration timeout, Context context)

パスで指定されたファイルにファイル全体を読み取ります。

FileReadResponse readWithResponse(OutputStream stream, FileRange range, DownloadRetryOptions options, DataLakeRequestConditions requestConditions, boolean getRangeContentMd5, Duration timeout, Context context)

ファイルから出力ストリームにバイト範囲を読み取ります。

DataLakeFileClient rename(String destinationFileSystem, String destinationPath)

ファイルをファイル システム内の別の場所に移動します。

Response<DataLakeFileClient> renameWithResponse(String destinationFileSystem, String destinationPath, DataLakeRequestConditions sourceRequestConditions, DataLakeRequestConditions destinationRequestConditions, Duration timeout, Context context)

ファイルをファイル システム内の別の場所に移動します。

void scheduleDeletion(FileScheduleDeletionOptions options)

ファイルの削除をスケジュールします。

Response<Void> scheduleDeletionWithResponse(FileScheduleDeletionOptions options, Duration timeout, Context context)

ファイルの削除をスケジュールします。

PathInfo upload(BinaryData data)

新しいファイルを 1 つ作成します。

PathInfo upload(BinaryData data, boolean overwrite)

新しいファイルを作成するか、既存のファイルの内容を更新します。

PathInfo upload(InputStream data, long length)

新しいファイルを 1 つ作成します。

PathInfo upload(InputStream data, long length, boolean overwrite)

新しいファイルを作成するか、既存のファイルの内容を更新します。

void uploadFromFile(String filePath)

指定したファイルの内容を含むファイルを作成します。

void uploadFromFile(String filePath, boolean overwrite)

指定したファイルの内容を含むファイルを作成します。

void uploadFromFile(String filePath, ParallelTransferOptions parallelTransferOptions, PathHttpHeaders headers, Map<String,String> metadata, DataLakeRequestConditions requestConditions, Duration timeout)

指定したファイルの内容を含むファイルを作成します。

Response<PathInfo> uploadFromFileWithResponse(String filePath, ParallelTransferOptions parallelTransferOptions, PathHttpHeaders headers, Map<String,String> metadata, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

指定したファイルの内容を含むファイルを作成します。

Response<PathInfo> uploadWithResponse(FileParallelUploadOptions options, Duration timeout, Context context)

新しいファイルを 1 つ作成します。

メソッドの継承元: DataLakePathClient

メソッドの継承元: java.lang.Object

メソッドの詳細

append

public void append(BinaryData data, long fileOffset)

後で flush の呼び出しによってフラッシュ (書き込まれる) されるように、指定されたリソースにデータを追加します

コード サンプル

client.append(binaryData, offset);
 System.out.println("Append data completed");

詳細については、Azure Docs に関するページを参照してください。

Parameters:

data - ファイルに書き込むデータ。
fileOffset - データを追加する位置。

append

public void append(InputStream data, long fileOffset, long length)

後で flush の呼び出しによってフラッシュ (書き込まれる) されるように、指定されたリソースにデータを追加します

コード サンプル

client.append(data, offset, length);
 System.out.println("Append data completed");

詳細については、Azure Docs に関するページを参照してください。

Parameters:

data - ファイルに書き込むデータ。
fileOffset - データを追加する位置。
length - データの正確な長さ。

appendWithResponse

public Response appendWithResponse(BinaryData data, long fileOffset, byte[] contentMd5, String leaseId, Duration timeout, Context context)

後で flush の呼び出しによってフラッシュ (書き込まれる) されるように、指定されたリソースにデータを追加します

コード サンプル

FileRange range = new FileRange(1024, 2048L);
 DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5);
 byte[] contentMd5 = new byte[0]; // Replace with valid md5

 Response<Void> response = client.appendWithResponse(binaryData, offset, contentMd5, leaseId, timeout,
     new Context(key1, value1));
 System.out.printf("Append data completed with status %d%n", response.getStatusCode());

詳細については、Azure Docs に関するページを参照してください。

Parameters:

data - ファイルに書き込むデータ。
fileOffset - データを追加する位置。
contentMd5 - データの内容の MD5 ハッシュ。 指定した場合、サービスは受信したデータの MD5 を計算し、指定された MD5 と一致しない場合は要求を失敗させます。
leaseId - リース ID を設定すると、指定されたリースがファイルのアクティブなリースと一致しない場合、要求は失敗します。
timeout - を引き RuntimeException 上げる省略可能なタイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

応答シグナリングの完了。

appendWithResponse

public Response appendWithResponse(BinaryData data, long fileOffset, DataLakeFileAppendOptions appendOptions, Duration timeout, Context context)

後で flush の呼び出しによってフラッシュ (書き込まれる) されるように、指定されたリソースにデータを追加します

コード サンプル

BinaryData binaryData = BinaryData.fromStream(data, length);
 FileRange range = new FileRange(1024, 2048L);
 byte[] contentMd5 = new byte[0]; // Replace with valid md5
 DataLakeFileAppendOptions appendOptions = new DataLakeFileAppendOptions()
     .setLeaseId(leaseId)
     .setContentHash(contentMd5)
     .setFlush(true);
 Response<Void> response = client.appendWithResponse(binaryData, offset, appendOptions, timeout,
     new Context(key1, value1));
 System.out.printf("Append data completed with status %d%n", response.getStatusCode());

詳細については、Azure Docs に関するページを参照してください。

Parameters:

data - ファイルに書き込むデータ。
fileOffset - データを追加する位置。
appendOptions - DataLakeFileAppendOptions
timeout - を引き RuntimeException 上げる省略可能なタイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

応答シグナリングの完了。

appendWithResponse

public Response appendWithResponse(InputStream data, long fileOffset, long length, byte[] contentMd5, String leaseId, Duration timeout, Context context)

後で flush の呼び出しによってフラッシュ (書き込まれる) されるように、指定されたリソースにデータを追加します

コード サンプル

FileRange range = new FileRange(1024, 2048L);
 DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5);
 byte[] contentMd5 = new byte[0]; // Replace with valid md5

 Response<Void> response = client.appendWithResponse(data, offset, length, contentMd5, leaseId, timeout,
     new Context(key1, value1));
 System.out.printf("Append data completed with status %d%n", response.getStatusCode());

詳細については、Azure Docs に関するページを参照してください。

Parameters:

data - ファイルに書き込むデータ。
fileOffset - データを追加する位置。
length - データの正確な長さ。
contentMd5 - データの内容の MD5 ハッシュ。 指定した場合、サービスは受信したデータの MD5 を計算し、指定された MD5 と一致しない場合は要求を失敗させます。
leaseId - リース ID を設定すると、指定されたリースがファイルのアクティブなリースと一致しない場合、要求は失敗します。
timeout - を引き RuntimeException 上げる省略可能なタイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

応答シグナリングの完了。

appendWithResponse

public Response appendWithResponse(InputStream data, long fileOffset, long length, DataLakeFileAppendOptions appendOptions, Duration timeout, Context context)

後で flush の呼び出しによってフラッシュ (書き込まれる) されるように、指定されたリソースにデータを追加します

コード サンプル

FileRange range = new FileRange(1024, 2048L);
 byte[] contentMd5 = new byte[0]; // Replace with valid md5
 DataLakeFileAppendOptions appendOptions = new DataLakeFileAppendOptions()
     .setLeaseId(leaseId)
     .setContentHash(contentMd5)
     .setFlush(true);
 Response<Void> response = client.appendWithResponse(data, offset, length, appendOptions, timeout,
     new Context(key1, value1));
 System.out.printf("Append data completed with status %d%n", response.getStatusCode());

詳細については、Azure Docs に関するページを参照してください。

Parameters:

data - ファイルに書き込むデータ。
fileOffset - データを追加する位置。
length - データの正確な長さ。
appendOptions - DataLakeFileAppendOptions
timeout - を引き RuntimeException 上げる省略可能なタイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

応答シグナリングの完了。

delete

public void delete()

ファイルを削除します。

コード サンプル

client.delete();
 System.out.println("Delete request completed");

詳細については、Azure Docs に関するページを参照してください。

deleteIfExists

public boolean deleteIfExists()

ファイルが存在する場合は削除します。

コード サンプル

client.deleteIfExists();
 System.out.println("Delete request completed");

詳細については、Azure Docs に関するページを参照してください。

Overrides:

DataLakeFileClient.deleteIfExists()

Returns:

true ファイルが正常に削除された場合は 。 false ファイルが存在しない場合は 。

deleteIfExistsWithResponse

public Response deleteIfExistsWithResponse(DataLakePathDeleteOptions options, Duration timeout, Context context)

ファイルが存在する場合は削除します。

コード サンプル

DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);
 DataLakePathDeleteOptions options = new DataLakePathDeleteOptions().setIsRecursive(false)
     .setRequestConditions(requestConditions);

 Response<Boolean> response = client.deleteIfExistsWithResponse(options, timeout, new Context(key1, value1));
 if (response.getStatusCode() == 404) {
     System.out.println("Does not exist.");
 } else {
     System.out.printf("Delete completed with status %d%n", response.getStatusCode());
 }

詳細については、Azure Docs に関するページを参照してください。

Overrides:

DataLakeFileClient.deleteIfExistsWithResponse(DataLakePathDeleteOptions options, Duration timeout, Context context)

Parameters:

timeout - を引き RuntimeException 上げる省略可能なタイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

状態コードと HTTP ヘッダーを含む応答。 の状態コードが 200 の場合 Response<T>、ファイルは正常に削除されました。 状態コードが 404 の場合、ファイルは存在しません。

deleteWithResponse

public Response deleteWithResponse(DataLakeRequestConditions requestConditions, Duration timeout, Context context)

ファイルを削除します。

コード サンプル

DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);

 client.deleteWithResponse(requestConditions, timeout, new Context(key1, value1));
 System.out.println("Delete request completed");

詳細については、Azure Docs に関するページを参照してください。

Parameters:

requestConditions - DataLakeRequestConditions
timeout - を引き RuntimeException 上げる省略可能なタイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

状態コードと HTTP ヘッダーを含む応答。

flush

@Deprecated
public PathInfo flush(long position)

非推奨

代わりに、「flush(long position, boolean overwrite)」を参照してください。

以前にファイルに追加されたデータを、追加する呼び出しを通じてフラッシュ (書き込み) します。 以前にアップロードしたデータは連続している必要があります。

既定では、このメソッドは既存のデータを上書きしません。

コード サンプル

client.flush(position);
 System.out.println("Flush data completed");

詳細については、Azure Docs に関するページを参照してください。

Parameters:

position - すべてのデータが書き込まれた後のファイルの長さ。

Returns:

作成されたリソースに関する情報。

flush

public PathInfo flush(long position, boolean overwrite)

以前にファイルに追加されたデータを、追加する呼び出しを通じてフラッシュ (書き込み) します。 以前にアップロードしたデータは連続している必要があります。

コード サンプル

boolean overwrite = true;
 client.flush(position, overwrite);
 System.out.println("Flush data completed");

詳細については、Azure Docs に関するページを参照してください。

Parameters:

position - すべてのデータが書き込まれた後のファイルの長さ。
overwrite - を上書きするかどうか。ファイルにデータが存在する必要があります。

Returns:

作成されたリソースに関する情報。

flushWithResponse

public Response flushWithResponse(long position, boolean retainUncommittedData, boolean close, PathHttpHeaders httpHeaders, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

追加する呼び出しを通じて、以前にファイルに追加されたデータをフラッシュ (書き込み) します。 以前にアップロードしたデータは連続している必要があります。

コード サンプル

FileRange range = new FileRange(1024, 2048L);
 DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5);
 byte[] contentMd5 = new byte[0]; // Replace with valid md5
 boolean retainUncommittedData = false;
 boolean close = false;
 PathHttpHeaders httpHeaders = new PathHttpHeaders()
     .setContentLanguage("en-US")
     .setContentType("binary");
 DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);

 Response<PathInfo> response = client.flushWithResponse(position, retainUncommittedData, close, httpHeaders,
     requestConditions, timeout, new Context(key1, value1));
 System.out.printf("Flush data completed with status %d%n", response.getStatusCode());

詳細については、Azure Docs に関するページを参照してください。

Parameters:

position - すべてのデータが書き込まれた後のファイルの長さ。
retainUncommittedData - コミットされていないデータを操作後に保持するかどうか。
close - 発生したファイル変更イベントが完了 (true) または変更 (false) を示すかどうか。
httpHeaders - PathHttpHeaders
requestConditions - DataLakeRequestConditions
timeout - が発生するオプションの RuntimeException タイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

作成されたリソースの情報を含む応答。

flushWithResponse

public Response flushWithResponse(long position, DataLakeFileFlushOptions flushOptions, Duration timeout, Context context)

追加する呼び出しを通じて、以前にファイルに追加されたデータをフラッシュ (書き込み) します。 以前にアップロードしたデータは連続している必要があります。

コード サンプル

FileRange range = new FileRange(1024, 2048L);
 DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5);
 byte[] contentMd5 = new byte[0]; // Replace with valid md5
 boolean retainUncommittedData = false;
 boolean close = false;
 PathHttpHeaders httpHeaders = new PathHttpHeaders()
     .setContentLanguage("en-US")
     .setContentType("binary");
 DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);

 Integer leaseDuration = 15;

 DataLakeFileFlushOptions flushOptions = new DataLakeFileFlushOptions()
     .setUncommittedDataRetained(retainUncommittedData)
     .setClose(close)
     .setPathHttpHeaders(httpHeaders)
     .setRequestConditions(requestConditions)
     .setLeaseAction(LeaseAction.ACQUIRE)
     .setLeaseDuration(leaseDuration)
     .setProposedLeaseId(leaseId);

 Response<PathInfo> response = client.flushWithResponse(position, flushOptions, timeout,
     new Context(key1, value1));
 System.out.printf("Flush data completed with status %d%n", response.getStatusCode());

詳細については、Azure Docs に関するページを参照してください。

Parameters:

position - すべてのデータが書き込まれた後のファイルの長さ。
flushOptions - DataLakeFileFlushOptions
timeout - が発生するオプションの RuntimeException タイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

作成されたリソースの情報を含む応答。

getCustomerProvidedKeyClient

public DataLakeFileClient getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey)

指定した DataLakeFileClient を使用して、新しい customerProvidedKey を作成します。

Overrides:

DataLakeFileClient.getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey)

Parameters:

customerProvidedKey - BLOB の には CustomerProvidedKey 、 を渡 null して、顧客が指定したキーを使用しません。

Returns:

指定 DataLakeFileClient した customerProvidedKeyを持つ 。

getFileName

public String getFileName()

完全なパスを含まない、このファイルの名前を取得します。

Returns:

ファイルの名前です。

getFilePath

public String getFilePath()

リソース自体の名前を含まない、このファイルのパスを取得します。

Returns:

ファイルのパス。

getFileUrl

public String getFileUrl()

Data Lake サービスでこのクライアントによって表されるファイルの URL を取得します。

Returns:

URL。

getOutputStream

public OutputStream getOutputStream()

ファイルにデータを書き込む出力ストリームを作成して開きます。 ファイルがサービスに既に存在する場合は、上書きされます。

Returns:

OutputStreamファイルへの書き込みに使用できる 。

getOutputStream

public OutputStream getOutputStream(DataLakeFileOutputStreamOptions options)

ファイルにデータを書き込む出力ストリームを作成して開きます。 ファイルがサービスに既に存在する場合は、上書きされます。

上書きを回避するには、"*" を に setIfNoneMatch(String ifNoneMatch)渡します。

Parameters:

Returns:

OutputStreamファイルへの書き込みに使用できる 。

getOutputStream

public OutputStream getOutputStream(DataLakeFileOutputStreamOptions options, Context context)

ファイルにデータを書き込む出力ストリームを作成して開きます。 ファイルがサービスに既に存在する場合は、上書きされます。

上書きを回避するには、"*" を に setIfNoneMatch(String ifNoneMatch)渡します。

Parameters:

context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

OutputStreamファイルへの書き込みに使用できる 。

openInputStream

public DataLakeFileOpenInputStreamResult openInputStream()

ファイル入力ストリームを開き、ファイルをダウンロードします。 ETag に対するロック。

DataLakeFileOpenInputStreamResult inputStream = client.openInputStream();

Returns:

InputStreamファイルからの読み取りに使用するストリームを表す オブジェクト。

openInputStream

public DataLakeFileOpenInputStreamResult openInputStream(DataLakeFileInputStreamOptions options)

ファイル入力ストリームを開き、指定した範囲のファイルをダウンロードします。 オプションが指定されていない場合、既定では ETag ロックが設定されます。

DataLakeFileInputStreamOptions options = new DataLakeFileInputStreamOptions().setBlockSize(1024)
     .setRequestConditions(new DataLakeRequestConditions());
 DataLakeFileOpenInputStreamResult streamResult = client.openInputStream(options);

Parameters:

Returns:

DataLakeFileOpenInputStreamResultファイルからの読み取りに使用するストリームを格納している オブジェクト。

openInputStream

public DataLakeFileOpenInputStreamResult openInputStream(DataLakeFileInputStreamOptions options, Context context)

ファイル入力ストリームを開き、指定した範囲のファイルをダウンロードします。 オプションが指定されていない場合、既定では ETag ロックが設定されます。

options = new DataLakeFileInputStreamOptions().setBlockSize(1024)
     .setRequestConditions(new DataLakeRequestConditions());
 DataLakeFileOpenInputStreamResult stream = client.openInputStream(options, new Context(key1, value1));

Parameters:

context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

DataLakeFileOpenInputStreamResultファイルからの読み取りに使用するストリームを格納している オブジェクト。

openQueryInputStream

public InputStream openQueryInputStream(String expression)

入力ストリームを開き、ファイルに対してクエリを実行します。

詳細については、Azure Docs に関するページを参照してください。

コード サンプル

String expression = "SELECT * from BlobStorage";
 InputStream inputStream = client.openQueryInputStream(expression);
 // Now you can read from the input stream like you would normally.

Parameters:

expression - クエリ式。

Returns:

InputStreamクエリ応答の読み取りに使用するストリームを表す オブジェクト。

openQueryInputStreamWithResponse

public Response openQueryInputStreamWithResponse(FileQueryOptions queryOptions)

入力ストリームを開き、ファイルに対してクエリを実行します。

詳細については、Azure Docs に関するページを参照してください。

コード サンプル

String expression = "SELECT * from BlobStorage";
 FileQuerySerialization input = new FileQueryDelimitedSerialization()
     .setColumnSeparator(',')
     .setEscapeChar('\n')
     .setRecordSeparator('\n')
     .setHeadersPresent(true)
     .setFieldQuote('"');
 FileQuerySerialization output = new FileQueryJsonSerialization()
     .setRecordSeparator('\n');
 DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId("leaseId");
 Consumer<FileQueryError> errorConsumer = System.out::println;
 Consumer<FileQueryProgress> progressConsumer = progress -> System.out.println("total file bytes read: "
     + progress.getBytesScanned());
 FileQueryOptions queryOptions = new FileQueryOptions(expression)
     .setInputSerialization(input)
     .setOutputSerialization(output)
     .setRequestConditions(requestConditions)
     .setErrorConsumer(errorConsumer)
     .setProgressConsumer(progressConsumer);

 InputStream inputStream = client.openQueryInputStreamWithResponse(queryOptions).getValue();
 // Now you can read from the input stream like you would normally.

Parameters:

queryOptions - FileQueryOptions.

Returns:

クエリ応答の読み取りに使用するストリームを表す オブジェクトを InputStream 含む、状態コードと HTTP ヘッダーを含む応答。

query

public void query(OutputStream stream, String expression)

ファイル全体を出力ストリームに照会します。

詳細については、Azure Docs に関するページを参照してください。

コード サンプル

ByteArrayOutputStream queryData = new ByteArrayOutputStream();
 String expression = "SELECT * from BlobStorage";
 client.query(queryData, expression);
 System.out.println("Query completed.");

Parameters:

stream - ダウンロードしたデータが書き込まれる null OutputStream 以外のインスタンス。
expression - クエリ式。

queryWithResponse

public FileQueryResponse queryWithResponse(FileQueryOptions queryOptions, Duration timeout, Context context)

ファイル全体を出力ストリームに照会します。

詳細については、Azure Docs に関するページを参照してください。

コード サンプル

ByteArrayOutputStream queryData = new ByteArrayOutputStream();
 String expression = "SELECT * from BlobStorage";
 FileQueryJsonSerialization input = new FileQueryJsonSerialization()
     .setRecordSeparator('\n');
 FileQueryDelimitedSerialization output = new FileQueryDelimitedSerialization()
     .setEscapeChar('\0')
     .setColumnSeparator(',')
     .setRecordSeparator('\n')
     .setFieldQuote('\'')
     .setHeadersPresent(true);
 DataLakeRequestConditions requestConditions = new DataLakeRequestConditions().setLeaseId(leaseId);
 Consumer<FileQueryError> errorConsumer = System.out::println;
 Consumer<FileQueryProgress> progressConsumer = progress -> System.out.println("total file bytes read: "
     + progress.getBytesScanned());
 FileQueryOptions queryOptions = new FileQueryOptions(expression, queryData)
     .setInputSerialization(input)
     .setOutputSerialization(output)
     .setRequestConditions(requestConditions)
     .setErrorConsumer(errorConsumer)
     .setProgressConsumer(progressConsumer);
 System.out.printf("Query completed with status %d%n",
     client.queryWithResponse(queryOptions, timeout, new Context(key1, value1))
         .getStatusCode());

Parameters:

queryOptions - FileQueryOptions.
timeout - が発生するオプションの RuntimeException タイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

状態コードと HTTP ヘッダーを含む応答。

read

public void read(OutputStream stream)

ファイル全体を出力ストリームに読み取ります。

コード サンプル

client.read(new ByteArrayOutputStream());
 System.out.println("Download completed.");

詳細については、Azure Docs に関するページを参照してください。

Parameters:

stream - ダウンロードしたデータが書き込まれる null OutputStream 以外のインスタンス。

readToFile

public PathProperties readToFile(String filePath)

パスで指定されたファイルにファイル全体を読み取ります。

ファイルが既に存在する場合は、ファイルが作成され、存在 FileAlreadyExistsException しない必要があります。 がスローされます。

コード サンプル

client.readToFile(file);
 System.out.println("Completed download to file");

詳細については、Azure Docs に関するページを参照してください。

Parameters:

filePath - Stringダウンロードしたデータが書き込まれる filePath を表す 。

Returns:

ファイルのプロパティとメタデータ。

readToFile

public PathProperties readToFile(String filePath, boolean overwrite)

パスで指定されたファイルにファイル全体を読み取ります。

overwrite が false に設定されている場合、ファイルは作成され、ファイルが既に存在する FileAlreadyExistsException 場合は存在しない必要があります。 がスローされます。

コード サンプル

boolean overwrite = false; // Default value
 client.readToFile(file, overwrite);
 System.out.println("Completed download to file");

詳細については、Azure Docs に関するページを参照してください。

Parameters:

filePath - Stringダウンロードしたデータが書き込まれる filePath を表す 。
overwrite - ファイルを上書きするかどうか。ファイルが存在する必要があります。

Returns:

ファイルのプロパティとメタデータ。

readToFileWithResponse

public Response readToFileWithResponse(String filePath, FileRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, DataLakeRequestConditions requestConditions, boolean rangeGetContentMd5, Set openOptions, Duration timeout, Context context)

パスで指定されたファイルにファイル全体を読み取ります。

既定では、ファイルは作成され、ファイルが既に存在する FileAlreadyExistsException 場合は存在しない必要があります。 がスローされます。 この動作をオーバーライドするには、適切な OpenOptions

コード サンプル

FileRange fileRange = new FileRange(1024, 2048L);
 DownloadRetryOptions downloadRetryOptions = new DownloadRetryOptions().setMaxRetryRequests(5);
 Set<OpenOption> openOptions = new HashSet<>(Arrays.asList(StandardOpenOption.CREATE_NEW,
     StandardOpenOption.WRITE, StandardOpenOption.READ)); // Default options

 client.readToFileWithResponse(file, fileRange, new ParallelTransferOptions().setBlockSizeLong(4L * Constants.MB),
     downloadRetryOptions, null, false, openOptions, timeout, new Context(key2, value2));
 System.out.println("Completed download to file");

詳細については、Azure Docs に関するページを参照してください。

Parameters:

filePath - Stringダウンロードしたデータが書き込まれる filePath を表す 。
range - FileRange
parallelTransferOptions - ParallelTransferOptions を使用してファイルにダウンロードします。 並列転送パラメーターの数は無視されます。
downloadRetryOptions - DownloadRetryOptions
requestConditions - DataLakeRequestConditions
rangeGetContentMd5 - 指定したファイル範囲の contentMD5 を返す必要があるかどうか。
openOptions - OpenOptions を使用して、ファイルを開くか作成する方法を構成します。
timeout - を引き RuntimeException 上げる省略可能なタイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

ファイルのプロパティとメタデータを含む応答。

readWithResponse

public FileReadResponse readWithResponse(OutputStream stream, FileRange range, DownloadRetryOptions options, DataLakeRequestConditions requestConditions, boolean getRangeContentMd5, Duration timeout, Context context)

ファイルから出力ストリームにバイト範囲を読み取ります。

コード サンプル

FileRange range = new FileRange(1024, 2048L);
 DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5);

 System.out.printf("Download completed with status %d%n",
     client.readWithResponse(new ByteArrayOutputStream(), range, options, null, false,
         timeout, new Context(key2, value2)).getStatusCode());

詳細については、Azure Docs に関するページを参照してください。

Parameters:

stream - ダウンロードしたデータが書き込まれる null OutputStream 以外のインスタンス。
range - FileRange
requestConditions - DataLakeRequestConditions
getRangeContentMd5 - 指定したファイル範囲の contentMD5 を返す必要があるかどうか。
timeout - を引き RuntimeException 上げる省略可能なタイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

状態コードと HTTP ヘッダーを含む応答。

rename

public DataLakeFileClient rename(String destinationFileSystem, String destinationPath)

ファイルをファイル システム内の別の場所に移動します。 詳細については、 Azure Docs を参照してください。

コード サンプル

DataLakeDirectoryAsyncClient renamedClient = client.rename(fileSystemName, destinationPath).block();
 System.out.println("Directory Client has been renamed");

Parameters:

destinationFileSystem - アカウント内の宛先のファイル システム。 null 現在のファイル システムの場合は 。
destinationPath - ファイルの名前を変更するファイル システムからの相対パスは、ファイル システム名を除外します。 たとえば、fileSystem = "myfilesystem" のファイルを移動する場合、path = "mydir/hello.txt" を myfilesystem 内の別のパス (例: newdir/hi.txt) に移動し、destinationPath = "newdir/hi.txt" を設定します。

Returns:

作成 DataLakeFileClient された新しいファイルを操作するために使用される 。

renameWithResponse

public Response renameWithResponse(String destinationFileSystem, String destinationPath, DataLakeRequestConditions sourceRequestConditions, DataLakeRequestConditions destinationRequestConditions, Duration timeout, Context context)

ファイルをファイル システム内の別の場所に移動します。 詳細については、 Azure Docs に関するページを参照してください。

コード サンプル

DataLakeRequestConditions sourceRequestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId);
 DataLakeRequestConditions destinationRequestConditions = new DataLakeRequestConditions();

 DataLakeFileClient newRenamedClient = client.renameWithResponse(fileSystemName, destinationPath,
     sourceRequestConditions, destinationRequestConditions, timeout, new Context(key1, value1)).getValue();
 System.out.println("Directory Client has been renamed");

Parameters:

destinationFileSystem - アカウント内の宛先のファイル システム。 null 現在のファイル システムの場合は 。
destinationPath - ファイルの名前を変更するファイル システムからの相対パスは、ファイル システム名を除外します。 たとえば、fileSystem = "myfilesystem" のファイルを移動する場合、path = "mydir/hello.txt" を myfilesystem 内の別のパス (例: newdir/hi.txt) に移動し、destinationPath = "newdir/hi.txt" を設定します。
sourceRequestConditions - DataLakeRequestConditions ソースに対して。
destinationRequestConditions - DataLakeRequestConditions を宛先に対して実行します。
timeout - を引き RuntimeException 上げる省略可能なタイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

作成 Response<T> された value ファイルの操作に使用される を DataLakeFileClient 含む を持つ 。

scheduleDeletion

public void scheduleDeletion(FileScheduleDeletionOptions options)

ファイルの削除をスケジュールします。

コード サンプル

FileScheduleDeletionOptions options = new FileScheduleDeletionOptions(OffsetDateTime.now().plusDays(1));
 client.scheduleDeletion(options);
 System.out.println("File deletion has been scheduled");

Parameters:

options - 削除パラメーターをスケジュールします。

scheduleDeletionWithResponse

public Response scheduleDeletionWithResponse(FileScheduleDeletionOptions options, Duration timeout, Context context)

ファイルの削除をスケジュールします。

コード サンプル

FileScheduleDeletionOptions options = new FileScheduleDeletionOptions(OffsetDateTime.now().plusDays(1));
 Context context = new Context("key", "value");

 client.scheduleDeletionWithResponse(options, timeout, context);
 System.out.println("File deletion has been scheduled");

Parameters:

options - 削除パラメーターをスケジュールします。
timeout - を引き RuntimeException 上げる省略可能なタイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

状態コードと HTTP ヘッダーを含む応答。

upload

public PathInfo upload(BinaryData data)

新しいファイルを 1 つ作成します。 既定では、このメソッドは既存のファイルを上書きしません。

コード サンプル

try {
     client.upload(binaryData);
     System.out.println("Upload from file succeeded");
 } catch (UncheckedIOException ex) {
     System.err.printf("Failed to upload from file %s%n", ex.getMessage());
 }

Parameters:

data - BLOB に書き込むデータ。 データはマーク可能である必要があります。 これは再試行をサポートするためです。 データがマーク可能でない場合は、データ ソースを BufferedInputStream にラップしてマーク サポートを追加することを検討してください。

Returns:

アップロードされたパスに関する情報。

upload

public PathInfo upload(BinaryData data, boolean overwrite)

新しいファイルを作成するか、既存のファイルの内容を更新します。

コード サンプル

try {
     boolean overwrite = false;
     client.upload(binaryData, overwrite);
     System.out.println("Upload from file succeeded");
 } catch (UncheckedIOException ex) {
     System.err.printf("Failed to upload from file %s%n", ex.getMessage());
 }

Parameters:

data - BLOB に書き込むデータ。 データはマーク可能である必要があります。 これは再試行をサポートするためです。 データがマーク可能でない場合は、データ ソースを BufferedInputStream にラップしてマーク サポートを追加することを検討してください。
overwrite - を上書きするかどうか。ファイルにデータが存在する必要があります。

Returns:

アップロードされたパスに関する情報。

upload

public PathInfo upload(InputStream data, long length)

新しいファイルを 1 つ作成します。 既定では、このメソッドは既存のファイルを上書きしません。

コード サンプル

try {
     client.upload(data, length);
     System.out.println("Upload from file succeeded");
 } catch (UncheckedIOException ex) {
     System.err.printf("Failed to upload from file %s%n", ex.getMessage());
 }

Parameters:

data - BLOB に書き込むデータ。 データはマーク可能である必要があります。 これは再試行をサポートするためです。 データがマーク可能でない場合は、データ ソースを BufferedInputStream にラップしてマーク サポートを追加することを検討してください。
length - データの正確な長さ。 この値は、 で InputStream提供されるデータの長さと正確に一致することが重要です。

Returns:

アップロードされたパスに関する情報。

upload

public PathInfo upload(InputStream data, long length, boolean overwrite)

新しいファイルを作成するか、既存のファイルの内容を更新します。

コード サンプル

try {
     boolean overwrite = false;
     client.upload(data, length, overwrite);
     System.out.println("Upload from file succeeded");
 } catch (UncheckedIOException ex) {
     System.err.printf("Failed to upload from file %s%n", ex.getMessage());
 }

Parameters:

data - BLOB に書き込むデータ。 データはマーク可能である必要があります。 これは再試行をサポートするためです。 データがマーク可能でない場合は、データ ソースを BufferedInputStream にラップしてマーク サポートを追加することを検討してください。
length - データの正確な長さ。 この値は、 で InputStream提供されるデータの長さと正確に一致することが重要です。
overwrite - を上書きするかどうか。ファイルにデータが存在する必要があります。

Returns:

アップロードされたパスに関する情報。

uploadFromFile

public void uploadFromFile(String filePath)

指定したファイルの内容を含むファイルを作成します。 既定では、このメソッドは既存のファイルを上書きしません。

コード サンプル

try {
     client.uploadFromFile(filePath);
     System.out.println("Upload from file succeeded");
 } catch (UncheckedIOException ex) {
     System.err.printf("Failed to upload from file %s%n", ex.getMessage());
 }

Parameters:

filePath - アップロードするファイルのパス

uploadFromFile

public void uploadFromFile(String filePath, boolean overwrite)

指定したファイルの内容を含むファイルを作成します。

コード サンプル

try {
     boolean overwrite = false;
     client.uploadFromFile(filePath, overwrite);
     System.out.println("Upload from file succeeded");
 } catch (UncheckedIOException ex) {
     System.err.printf("Failed to upload from file %s%n", ex.getMessage());
 }

Parameters:

filePath - アップロードするファイルのパス
overwrite - ファイルが既に存在するかどうかを上書きするかどうか

uploadFromFile

public void uploadFromFile(String filePath, ParallelTransferOptions parallelTransferOptions, PathHttpHeaders headers, Map metadata, DataLakeRequestConditions requestConditions, Duration timeout)

指定したファイルの内容を含むファイルを作成します。

上書きされないようにするには、"*" を に setIfNoneMatch(String ifNoneMatch)渡します。

コード サンプル

PathHttpHeaders headers = new PathHttpHeaders()
     .setContentMd5("data".getBytes(StandardCharsets.UTF_8))
     .setContentLanguage("en-US")
     .setContentType("binary");

 Map<String, String> metadata = Collections.singletonMap("metadata", "value");
 DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId)
     .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3));
 Long blockSize = 100L * 1024L * 1024L; // 100 MB;
 ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize);

 try {
     client.uploadFromFile(filePath, parallelTransferOptions, headers, metadata, requestConditions, timeout);
     System.out.println("Upload from file succeeded");
 } catch (UncheckedIOException ex) {
     System.err.printf("Failed to upload from file %s%n", ex.getMessage());
 }

Parameters:

filePath - アップロードするファイルのパス
parallelTransferOptions - ParallelTransferOptions バッファー内のアップロードを構成するために使用されます。
headers - PathHttpHeaders
metadata - リソースに関連付けるメタデータ。 メタデータ キーまたは値に先頭または末尾の空白がある場合は、削除またはエンコードする必要があります。
requestConditions - DataLakeRequestConditions
timeout - を引き RuntimeException 上げる省略可能なタイムアウト値。

uploadFromFileWithResponse

public Response uploadFromFileWithResponse(String filePath, ParallelTransferOptions parallelTransferOptions, PathHttpHeaders headers, Map metadata, DataLakeRequestConditions requestConditions, Duration timeout, Context context)

指定したファイルの内容を含むファイルを作成します。

上書きされないようにするには、"*" を に setIfNoneMatch(String ifNoneMatch)渡します。

コード サンプル

PathHttpHeaders headers = new PathHttpHeaders()
     .setContentMd5("data".getBytes(StandardCharsets.UTF_8))
     .setContentLanguage("en-US")
     .setContentType("binary");

 Map<String, String> metadata = Collections.singletonMap("metadata", "value");
 DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId)
     .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3));
 Long blockSize = 100L * 1024L * 1024L; // 100 MB;
 ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize);

 try {
     Response<PathInfo> response = client.uploadFromFileWithResponse(filePath, parallelTransferOptions, headers,
         metadata, requestConditions, timeout, new Context("key", "value"));
     System.out.printf("Upload from file succeeded with status %d%n", response.getStatusCode());
 } catch (UncheckedIOException ex) {
     System.err.printf("Failed to upload from file %s%n", ex.getMessage());
 }

Parameters:

filePath - アップロードするファイルのパス
parallelTransferOptions - ParallelTransferOptions バッファー内のアップロードを構成するために使用されます。
headers - PathHttpHeaders
metadata - リソースに関連付けるメタデータ。 メタデータ キーまたは値に先頭または末尾の空白がある場合は、削除またはエンコードする必要があります。
requestConditions - DataLakeRequestConditions
timeout - を引き RuntimeException 上げる省略可能なタイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

アップロードされたパスに関する情報を含む応答。

uploadWithResponse

public Response uploadWithResponse(FileParallelUploadOptions options, Duration timeout, Context context)

新しいファイルを 1 つ作成します。 上書きされないようにするには、"*" を に setIfNoneMatch(String ifNoneMatch)渡します。

コード サンプル

PathHttpHeaders headers = new PathHttpHeaders()
     .setContentMd5("data".getBytes(StandardCharsets.UTF_8))
     .setContentLanguage("en-US")
     .setContentType("binary");

 Map<String, String> metadata = Collections.singletonMap("metadata", "value");
 DataLakeRequestConditions requestConditions = new DataLakeRequestConditions()
     .setLeaseId(leaseId)
     .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3));
 Long blockSize = 100L * 1024L * 1024L; // 100 MB;
 ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize);

 try {
     client.uploadWithResponse(new FileParallelUploadOptions(data, length)
         .setParallelTransferOptions(parallelTransferOptions).setHeaders(headers)
         .setMetadata(metadata).setRequestConditions(requestConditions)
         .setPermissions("permissions").setUmask("umask"), timeout, new Context("key", "value"));
     System.out.println("Upload from file succeeded");
 } catch (UncheckedIOException ex) {
     System.err.printf("Failed to upload from file %s%n", ex.getMessage());
 }

Parameters:

timeout - を引き RuntimeException 上げる省略可能なタイムアウト値。
context - サービス呼び出し中に Http パイプラインを介して渡される追加のコンテキスト。

Returns:

アップロードされたパスに関する情報。

適用対象