Interface WriteChannel

All Superinterfaces:
AutoCloseable, Channel, Closeable, Restorable<WriteChannel>, WritableByteChannel
All Known Implementing Classes:
BaseWriteChannel

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 Channel.close(). This interface implements Restorable to allow saving the writer's state to continue writing afterwards.

  • Method Summary

    Modifier and Type
    Method
    Description
    Captures the write channel state so that it can be saved and restored afterwards.
    void
    setChunkSize(int chunkSize)
    Sets the minimum size that will be written by a single RPC.

    Methods inherited from interface java.nio.channels.Channel

    close, isOpen

    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

      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.
      Specified by:
      capture in interface Restorable<WriteChannel>
      Returns:
      a RestorableState object that contains the write channel state and can restore it afterwards.