Package io.micronaut.http.body
Interface CloseableByteBody
- All Superinterfaces:
AutoCloseable
,ByteBody
,Closeable
- All Known Subinterfaces:
CloseableAvailableByteBody
- All Known Implementing Classes:
AvailableNettyByteBody
,StreamingNettyByteBody
A
Closeable
version of ByteBody
. close()
releases any resources
that may still be held. No other operations on this body are valid after close()
, but
multiple calls to close()
are allowed (though only the first will do anything). If a
primary operation (see ByteBody
) is performed on this body, you can but do not
need to close it anymore. Closing becomes a no-op in that case.- Since:
- 4.5.0
- Author:
- Jonas Konrad
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.http.body.ByteBody
ByteBody.BodyDiscardedException, ByteBody.SplitBackpressureMode
-
Method Summary
Modifier and TypeMethodDescriptiondefault @NonNull CloseableByteBody
Signal that the upstream may discard any remaining body data.void
close()
Clean up any resources held by this instance.Methods inherited from interface io.micronaut.http.body.ByteBody
buffer, expectedLength, split, split, toByteArrayPublisher, toByteBufferPublisher, toInputStream
-
Method Details
-
allowDiscard
Description copied from interface:ByteBody
Signal that the upstream may discard any remaining body data. Only if all consumers of the body allow discarding will the body be discarded, otherwise it will still be sent to all consumers. It is an optional operation.Discarding may be implemented e.g. by closing the input side of an HTTP/2 stream.
This method must be called before any primary operation.
- Specified by:
allowDiscard
in interfaceByteBody
- Returns:
- This body
-
close
void close()Clean up any resources held by this instance. See class documentation.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-