Class CancellableOutputStream

java.lang.Object
java.io.OutputStream
software.amazon.awssdk.utils.CancellableOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
Direct Known Subclasses:
OutputStreamPublisher

public abstract class CancellableOutputStream extends OutputStream
An implementation of OutputStream to which writing can be cancel()ed.

Cancelling tells the downstream receiver of the output that the stream will not be written to anymore, and that the data sent was incomplete. The stream must still be OutputStream.close()d by the caller.

  • Constructor Details

    • CancellableOutputStream

      public CancellableOutputStream()
  • Method Details

    • cancel

      public abstract void cancel()
      Cancel writing to the stream. This is different than OutputStream.close() in that it indicates the data written so far is truncated and incomplete. Callers must still invoke OutputStream.close() even if the stream is cancelled.