From dc31e95158e66d0eb4c85122edd29431a610a204 Mon Sep 17 00:00:00 2001 From: JesseLovelace <43148100+JesseLovelace@users.noreply.github.com> Date: Tue, 4 Jun 2024 09:28:27 -0700 Subject: [PATCH] docs: update javadoc for createFrom (#2522) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: update javadoc for createFrom * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../java/com/google/cloud/storage/Storage.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java index 1a860a05ee..fca1d1294d 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java @@ -2906,18 +2906,16 @@ Blob create( Blob createFrom(BlobInfo blobInfo, Path path, BlobWriteOption... options) throws IOException; /** - * Uploads {@code path} to the blob using {@link #writer} and {@code bufferSize}. By default any - * MD5 and CRC32C values in the given {@code blobInfo} are ignored unless requested via the {@link + * Uploads {@code path} to the blob using {@code ResumableSession}. By default any MD5 and CRC32C + * values in the given {@code blobInfo} are ignored unless requested via the {@link * BlobWriteOption#md5Match()} and {@link BlobWriteOption#crc32cMatch()} options. Folder upload is * not supported. Note that all * non-editable metadata, such as generation or metageneration, will be ignored even if it's * present in the provided BlobInfo object. * - *

{@link #createFrom(BlobInfo, Path, BlobWriteOption...)} invokes this method with a buffer - * size of 15 MiB. Users can pass alternative values. Larger buffer sizes might improve the upload - * performance but require more memory. This can cause an OutOfMemoryError or add significant - * garbage collection overhead. Smaller buffer sizes reduce memory consumption, that is noticeable - * when uploading many objects in parallel. Buffer sizes less than 256 KiB are treated as 256 KiB. + *

This method used to preallocate a buffer, but since v2.25.0, it uses a ResumableSession and + * no longer needs it. The bufferSize parameter is still present for binary compatibility, but is + * now ignored. * *

Example of uploading a humongous file: * @@ -2925,14 +2923,13 @@ Blob create( * BlobId blobId = BlobId.of(bucketName, blobName); * BlobInfo blobInfo = BlobInfo.newBuilder(blobId).setContentType("video/webm").build(); * - * int largeBufferSize = 150 * 1024 * 1024; * Path file = Paths.get("humongous.file"); - * storage.createFrom(blobInfo, file, largeBufferSize); + * storage.createFrom(blobInfo, file, 0); * } * * @param blobInfo blob to create * @param path file to upload - * @param bufferSize size of the buffer I/O operations + * @param bufferSize ignored field, still present for compatibility purposes * @param options blob write options * @return a {@code Blob} with complete information * @throws IOException on I/O error