primary
- Parameters:
primary
- The consumer ornull
to discard the data- Returns:
- The upstream to signal backpressure
SB
- The shared buffer typeByteBody
, CloseableByteBody
, Closeable
, AutoCloseable
ReactiveByteBufferByteBody
, StreamingNettyByteBody
ByteBody
s based on a
BaseSharedBuffer
.ByteBody.BodyDiscardedException, ByteBody.SplitBackpressureMode
protected
BaseStreamingByteBody(SB sharedBuffer,
BufferConsumer.Upstream upstream)
final @NonNull CloseableByteBody
protected abstract @NonNull BaseStreamingByteBody<SB>
derive(BufferConsumer.Upstream upstream)
final @NonNull OptionalLong
Content-Length
or from
previous buffering).final @NonNull CloseableByteBody
move()
CloseableByteBody
with the same content but an independent lifecycle,
claiming this body in the process.abstract BufferConsumer.Upstream
primary(@Nullable BufferConsumer primary)
final @NonNull InputStream
InputStream
.final @NonNull Publisher<ReadBuffer>
ReadBuffer
s.buffer, bufferFlow, bufferFlow, failClaim, recordClosed, recordPrimaryOp, toByteArrayPublisher
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
buffer, split, split, toByteArrayPublisher, toByteBufferPublisher, touch
close
ByteBody
Content-Length
or from
previous buffering). The actual length will never exceed this value, though it may sometimes
be lower if there is a connection error.
This value may go from OptionalLong.empty()
to a known value over the lifetime of
this body.
This is not a primary operation and does not modify this ByteBody
.
expectedLength
in interface ByteBody
primary
- The consumer or null
to discard the datamove()
.upstream
- The upstreamByteBody
ReadBuffer
s. Note that the caller must take
care to release the returned buffers.
This is a primary operation. After this operation, no other primary operation or
ByteBody.split()
may be done.
toReadBufferPublisher
in interface ByteBody
toReadBufferPublisher
in class InternalByteBody
ByteBody
InputStream
.
This is a primary operation. After this operation, no other primary operation or
ByteBody.split()
may be done.
toInputStream
in interface ByteBody
ByteBody
CloseableByteBody
with the same content but an independent lifecycle,
claiming this body in the process.
This is a primary operation. After this operation, no other primary operation or
ByteBody.split()
may be done.
The purpose of this method is to move the data to a different component in an
application, making clear that the receiving component claims ownership of the body. If the
sending component then closes the original ByteBody
for example, it will have no
impact on the new CloseableByteBody
that the receiver is working with.
move
in interface ByteBody
CloseableByteBody
with the same content.ByteBody
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.
allowDiscard
in interface ByteBody
allowDiscard
in interface CloseableByteBody