Interface FlushedCloseable

All Superinterfaces:
AutoCloseable, Closeable, Flushable

public interface FlushedCloseable extends Flushable, Closeable
A marker interface that the stream provided to Jersey can implement, noting that the stream does not need to call Flushable.flush() prior to close(). That way, Flushable.flush() method is not called twice.

Usable by javax.ws.rs.client.ClientRequestContext#setEntityStream(OutputStream). Usable by javax.ws.rs.container.ContainerResponseContext#setEntityStream(OutputStream).

This marker interface can be useful for the customer OutputStream to know the flush did not come from Jersey before close. By default, when the entity stream is to be closed by Jersey, flush is called first.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Flushes this stream by writing any buffered output to the underlying stream.

    Methods inherited from interface java.io.Flushable

    flush
  • Method Details

    • close

      void close() throws IOException
      Flushes this stream by writing any buffered output to the underlying stream. Then closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

      As noted in AutoCloseable.close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException - if an I/O error occurs