Package com.google.cloud
Interface WriteChannel
- All Superinterfaces:
AutoCloseable,Channel,Closeable,Restorable<WriteChannel>,WritableByteChannel
- All Known Implementing Classes:
BaseWriteChannel
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 Channel.close(). This interface implements
Restorable to allow saving the writer's state to continue writing afterwards.
-
Method Summary
Modifier and TypeMethodDescriptioncapture()Captures the write channel state so that it can be saved and restored afterwards.voidsetChunkSize(int chunkSize) Sets the minimum size that will be written by a single RPC.Methods inherited from interface java.nio.channels.WritableByteChannel
write
-
Method Details
-
setChunkSize
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. -
capture
RestorableState<WriteChannel> capture()Captures the write channel state so that it can be saved and restored afterwards. The originalWriteChanneland the restored one should not both be used. Closing one channel causes the other channel to close; subsequent writes will fail.- Specified by:
capturein interfaceRestorable<WriteChannel>- Returns:
- a
RestorableStateobject that contains the write channel state and can restore it afterwards.
-