Interface BlobWriteSession (2.36.1)

public interface BlobWriteSession

A session to write an object to Google Cloud Storage.

A session can only write a single version of an object. If writing multiple versions of an object a new session must be created each time.

Provides an api that allows writing to and retrieving the resulting BlobInfo after write finalization.

The underlying implementation is dictated based upon the specified BlobWriteSessionConfig provided at StorageOptions creation time. See Also: BlobWriteSessionConfigs, GrpcStorageOptions.Builder#setBlobWriteSessionConfig(BlobWriteSessionConfig), BlobWriteSessionConfig

Methods

getResult()

public abstract ApiFuture<BlobInfo> getResult()

Return an ApiFuture<BlobInfo> which will represent the state of the object upon finalization and success response from Google Cloud Storage.

This future will not resolve until: 1. The object is successfully finalized and created in Google Cloud Storage 2. A terminal failure occurs, the terminal failure will become the exception result

Returns
Type Description
ApiFuture<BlobInfo>

open()

public abstract WritableByteChannel open()

Open the WritableByteChannel for this session.

A session may only be opened once. If multiple calls to open are made, an illegal state exception will be thrown

Upon calling WritableByteChannel#close() the object creation will be finalized, and #getResult()s future should resolve.

Returns
Type Description
WritableByteChannel
Exceptions
Type Description
IOException

When creating the WritableByteChannel if an unrecoverable underlying IOException occurs it can be rethrown