バイナリデータ処理の変更 - AWS SDK for Java 2.x

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

バイナリデータ処理の変更

バージョン 1 では、バイナリデータは ByteBuffer オブジェクトを使用して直接処理されていました。バージョン 2 では、SDK はバイナリデータを使用するためのより便利で型の安全性が高い方法を提供する SdkBytes オブジェクトを使用します。

移行ツールを使用して自動的に SdkBytesByteBuffer に変換することも、返された SdkBytes オブジェクトで asByteBuffer() を呼び出すことで手動で変換することもできます。

例 - バージョン 1 でメッセージ属性からバイナリデータを取得する
// Get binary data from a message attribute MessageAttributeValue messageAttributeValue = new MessageAttributeValue(); ByteBuffer binaryValue = messageAttributeValue.getBinaryValue(); String binaryString = new String(messageAttributeValue.getBinaryValue().array());
例 - バージョン 2 でメッセージ属性からバイナリデータを取得する
// Get binary data from a message attribute MessageAttributeValue messageAttributeValue = MessageAttributeValue.builder().build(); ByteBuffer binaryValue = messageAttributeValue.binaryValue().asByteBuffer(); String binaryString = new String(messageAttributeValue.binaryValue().asByteBuffer().array());