Interface WriteChannel (2.33.0)

publicinterfaceWriteChannelextendsWritableByteChannel,Closeable,Restorable<WriteChannel>

Implements

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

Methods

capture()

publicabstractRestorableState<WriteChannel>capture()

Captures the write channel state so that it can be saved and restored afterwards. The originalWriteChannel 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>

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

setChunkSize(int chunkSize)

publicabstractvoidsetChunkSize(intchunkSize)

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

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-01-31 UTC.