APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.net.http.http3.frames

public abstract sealed Class PartialFrame

extends AbstractHttp3Frame
permits HeadersFrame, DataFrame, PushPromiseFrame, UnknownFrame
Class Inheritance
Known Direct Subclasses
jdk.internal.net.http.http3.frames.PushPromiseFrame, jdk.internal.net.http.http3.frames.UnknownFrame, jdk.internal.net.http.http3.frames.DataFrame, jdk.internal.net.http.http3.frames.HeadersFrame
Imports
java.nio.ByteBuffer, java.util.List, jdk.internal.net.http.quic.VariableLengthEncoder, .BuffersReader, jdk.internal.net.http.quic.streams.QuicStreamReader

A PartialFrame helps to read the payload of a frame. This class is not multi-thread safe.

Field Summary

Modifier and TypeField and Description
private static final List<ByteBuffer>
private long
private final long
Inherited from jdk.internal.net.http.http3.frames.AbstractHttp3Frame:
RANDOMtype

Constructor Summary

AccessConstructor and Description
pack-priv
PartialFrame(long frameType, long streamingLength)

Method Summary

Modifier and TypeMethod and Description
public final List<ByteBuffer>

Returns:

the payload bytes available so far, an empty list if no bytes are available or the whole payload has already been read
nextPayloadBytes
(BuffersReader
a BuffersReader that contains payload bytes.
buffers
)

Reads remaining payload bytes from the given BuffersReader.

public final ByteBuffer

Returns:

the payload bytes available in the given buffer, or null if all payload has been read.
nextPayloadBytes
(ByteBuffer
a ByteBuffer that contains payload bytes.
buffer
)

Reads remaining payload bytes from the given ByteBuffer.

public final long

Returns:

the number of payload bytes that remains to read
remaining
()

Returns the number of payload bytes that remains to read.

public final long
streamingLength()

Overrides jdk.internal.net.http.http3.frames.AbstractHttp3Frame.streamingLength.

Overrides default jdk.internal.net.http.http3.frames.Http3Frame.streamingLength.

Returns the portion of the frame payload that can be read after the frame was created, when the current frame can be read as a partial frame, otherwise 0, if the payload can't be streamed.

public String
toString()

Overrides jdk.internal.net.http.http3.frames.AbstractHttp3Frame.toString.

Returns a string representation of the object.

public void
writeHeaders(ByteBuffer
a buffer to write the headers into
buf
)

Write the frame headers to the given buffer.

Inherited from jdk.internal.net.http.http3.frames.AbstractHttp3Frame:
checkPayloadSizedecodeRequiredTypeheadersSizesizetypetypeAsString

Field Detail

NONEback to summary
private static final List<ByteBuffer> NONE
remainingback to summary
private long remaining
streamingLengthback to summary
private final long streamingLength

Constructor Detail

PartialFrameback to summary
pack-priv PartialFrame(long frameType, long streamingLength)

Method Detail

nextPayloadBytesback to summary
public final List<ByteBuffer> nextPayloadBytes(BuffersReader buffers)

Reads remaining payload bytes from the given BuffersReader. This method must not run concurrently with any code that submit new buffers to the BuffersReader.

Parameters
buffers:BuffersReader

a BuffersReader that contains payload bytes.

Returns:List<ByteBuffer>

the payload bytes available so far, an empty list if no bytes are available or the whole payload has already been read

nextPayloadBytesback to summary
public final ByteBuffer nextPayloadBytes(ByteBuffer buffer)

Reads remaining payload bytes from the given ByteBuffer.

Parameters
buffer:ByteBuffer

a ByteBuffer that contains payload bytes.

Returns:ByteBuffer

the payload bytes available in the given buffer, or null if all payload has been read.

remainingback to summary
public final long remaining()

Returns the number of payload bytes that remains to read.

Returns:long

the number of payload bytes that remains to read

streamingLengthback to summary
public final long streamingLength()

Overrides jdk.internal.net.http.http3.frames.AbstractHttp3Frame.streamingLength.

Overrides default jdk.internal.net.http.http3.frames.Http3Frame.streamingLength.

Doc from jdk.internal.net.http.http3.frames.Http3Frame.streamingLength.

Returns the portion of the frame payload that can be read after the frame was created, when the current frame can be read as a partial frame, otherwise 0, if the payload can't be streamed.

Annotations
@Override
toStringback to summary
public String toString()

Overrides jdk.internal.net.http.http3.frames.AbstractHttp3Frame.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
writeHeadersback to summary
public void writeHeaders(ByteBuffer buf)

Write the frame headers to the given buffer.

API Note

The caller will be responsible for writing the remaining length bytes of the frame content after writing the frame headers.

Implementation Specification

Usually the header of a frame is assumed to simply contain the frame type and frame length. Some subclasses of AbstractHttp3Frame may however include some additional information. For instance, PushPromiseFrame may consider the pushId as being in part of the headers, and write it along in this method after the frame type and length. In such a case, a subclass would also need to override headersSize() in order to add the size of the additional information written by writeHeaders(ByteBuffer).

Parameters
buf:ByteBuffer

a buffer to write the headers into