@Override public StructuredJsonGenerator writeValue(ByteBuffer bytes) { try { writer.writeBlob(BinaryUtils.copyAllBytesFrom(bytes)); } catch (IOException e) { throw SdkClientException.builder().cause(e).build(); } return this; }
/** * Creates a {@link AsyncRequestBody} from a {@link ByteBuffer}. Buffer contents are copied so any modifications * made to the original {@link ByteBuffer} are not reflected in the {@link AsyncRequestBody}. * * @param byteBuffer ByteBuffer to send to the service. * @return AsyncRequestBody instance. */ static AsyncRequestBody fromByteBuffer(ByteBuffer byteBuffer) { return new ByteArrayAsyncRequestBody(BinaryUtils.copyAllBytesFrom(byteBuffer)); }
/** * Creates a {@link RequestBody} from a {@link ByteBuffer}. Buffer contents are copied so any modifications * made to the original {@link ByteBuffer} are not reflected in the {@link RequestBody}. * * @param byteBuffer ByteBuffer to send to the service. * @return RequestBody instance. */ public static RequestBody fromByteBuffer(ByteBuffer byteBuffer) { return fromBytesDirect(BinaryUtils.copyAllBytesFrom(byteBuffer)); }
@Override public StructuredJsonGenerator writeValue(ByteBuffer bytes) { try { writer.writeBlob(BinaryUtils.copyAllBytesFrom(bytes)); } catch (IOException e) { throw SdkClientException.builder().cause(e).build(); } return this; }