Package org.glassfish.jersey.io.spi
Interface FlushedCloseable
- All Superinterfaces:
AutoCloseable
,Closeable
,Flushable
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 TypeMethodDescriptionvoid
close()
Flushes this stream by writing any buffered output to the underlying stream.
-
Method Details
-
close
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 theCloseable
as closed, prior to throwing theIOException
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
- if an I/O error occurs
-