Interface WriteChannel (2.5.11)

public interface WriteChannel extends WritableByteChannel, Closeable, Restorable<WriteChannel>

A channel for writing data to Google Cloud services.

Implementations of this class may further buffer data internally to reduce remote calls. Written data might not be visible until calling #close(). This interface implements Restorable to allow saving the writer's state to continue writing afterwards.

Implements

WritableByteChannel, Closeable, com.google.cloud.Restorable<com.google.cloud.WriteChannel>

Methods

capture()

public abstract RestorableState<WriteChannel> capture()

Captures the write channel state so that it can be saved and restored afterwards. The original WriteChannel and the restored one should not both be used. Closing one channel causes the other channel to close; subsequent writes will fail.

Returns
TypeDescription
RestorableState<WriteChannel>

a RestorableState object that contains the write channel state and can restore it afterwards.

setChunkSize(int chunkSize)

public abstract void setChunkSize(int chunkSize)

Sets the minimum size that will be written by a single RPC. Written data will be buffered and only flushed upon reaching this size or closing the channel.

Parameter
NameDescription
chunkSizeint