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

public final Class StreamFrame

extends QuicFrame
Class Inheritance
Imports
java.nio.BufferOverflowException, .ByteBuffer, java.util.Objects, jdk.internal.net.http.common.Utils, jdk.internal.net.http.quic.packets.QuicPacketEncoder, jdk.internal.net.quic.QuicTransportException

A STREAM Frame
External Specification
https://www.rfc-editor.org/info/rfc9000

Field Summary

Modifier and TypeField and Description
private final int
private static final int
private final boolean
private static final int
private final int
private static final int
private final long
private final ByteBuffer
private final long
private final boolean
Inherited from jdk.internal.net.http.quic.frames.QuicFrame:
ACKCONNECTION_CLOSECRYPTODATA_BLOCKEDHANDSHAKE_DONEMAX_DATAMAX_STREAM_DATAMAX_STREAMSMAX_VL_INTEGERNEW_CONNECTION_IDNEW_TOKENPADDINGPATH_CHALLENGEPATH_RESPONSEPINGRESET_STREAMRETIRE_CONNECTION_IDSTOP_SENDINGSTREAMSTREAM_DATA_BLOCKEDSTREAMS_BLOCKED

Constructor Summary

AccessConstructor and Description
pack-priv
StreamFrame(ByteBuffer buffer, int type)

public
StreamFrame(long streamID, long offset, int length, boolean fin, ByteBuffer streamData)

Creates StreamFrame (length == -1 means no length specified in frame and is assumed to occupy the remainder of the Quic/UDP packet.

private
StreamFrame(long streamID, long offset, int length, boolean fin, ByteBuffer streamData, boolean slice)

Method Summary

Modifier and TypeMethod and Description
public static int
public int

Returns:

the number of data bytes in the frame
dataLength
()

Returns the number of data bytes in the frame.

public void
encode(ByteBuffer dest)

Implements abstract jdk.internal.net.http.quic.frames.QuicFrame.encode.

Encode this QUIC Frame into given ByteBuffer

public long
getTypeField()

Overrides jdk.internal.net.http.quic.frames.QuicFrame.getTypeField.

Returns the type field that was / should be encoded.

public boolean

Returns:

whether this frame has a length
hasLength
()

Returns whether this frame has a length.

public static int

Returns:

the estimated size of the header for a StreamFrame that would be created with the given parameters.
headerSize
(QuicPacketEncoder
the QuicPacketEncoder - which can be used in case some part of the computation is Quic-version dependent.
encoder
,
long
the stream id
streamId
,
long
the stream offset
offset
,
long
the estimated length of the frame, typically this will be the min between the data available in the stream with respect to flow control, and the maximum remaining size for the datagram payload
length
)

Computes the header size that would be required to encode a frame with the given streamId, offset, and length.

public boolean

Returns:

true if this is the last frame in the stream
isLast
()

Returns true if this is the last frame in the stream.

public long

Returns:

the frame offset
offset
()

Returns the frame offset.

public ByteBuffer

Returns:

the frame payload
payload
()

Returns the frame payload.

public int
size()

Implements abstract jdk.internal.net.http.quic.frames.QuicFrame.size.

Returns the minimum number of bytes needed to encode this frame.

public StreamFrame

Returns:

a slice of the current stream frame
slice
(long
the new offset
offset
,
int
the new length
length
)

Creates a new StreamFrame which is a slice of this stream frame.

public long

Returns:

the stream id
streamId
()

Returns the stream id.

public String
toString()

Overrides jdk.internal.net.http.quic.frames.QuicFrame.toString.

Returns a string representation of the object.

Inherited from jdk.internal.net.http.quic.frames.QuicFrame:
decodedecodeVLFielddecodeVLFieldAsIntencodeVLFieldframeClassOfframeTypeframeTypeOfgetVLFieldLengthForisAckElicitingisValidInputByteBufferrequireVLRangerequireVLRangevalidateRemainingLength

Field Detail

dataLengthback to summary
private final int dataLength
FINback to summary
private static final int FIN
finback to summary
private final boolean fin
LENback to summary
private static final int LEN
lengthback to summary
private final int length
OFFback to summary
private static final int OFF
offsetback to summary
private final long offset
streamDataback to summary
private final ByteBuffer streamData
streamIDback to summary
private final long streamID
typeFieldHasOFFback to summary
private final boolean typeFieldHasOFF

Constructor Detail

StreamFrameback to summary
pack-priv StreamFrame(ByteBuffer buffer, int type) throws QuicTransportException
StreamFrameback to summary
public StreamFrame(long streamID, long offset, int length, boolean fin, ByteBuffer streamData)

Creates StreamFrame (length == -1 means no length specified in frame and is assumed to occupy the remainder of the Quic/UDP packet. If a length is specified then it must correspond with the remaining bytes in streamData

StreamFrameback to summary
private StreamFrame(long streamID, long offset, int length, boolean fin, ByteBuffer streamData, boolean slice)

Method Detail

compareOffsetsback to summary
public static int compareOffsets(StreamFrame sf1, StreamFrame sf2)
dataLengthback to summary
public int dataLength()

Returns the number of data bytes in the frame.

API Note

This is equivalent to calling payload().remaining().

Returns:int

the number of data bytes in the frame

encodeback to summary
public void encode(ByteBuffer dest)

Implements abstract jdk.internal.net.http.quic.frames.QuicFrame.encode.

Doc from jdk.internal.net.http.quic.frames.QuicFrame.encode.

Encode this QUIC Frame into given ByteBuffer

Annotations
@Override
getTypeFieldback to summary
public long getTypeField()

Overrides jdk.internal.net.http.quic.frames.QuicFrame.getTypeField.

Doc from jdk.internal.net.http.quic.frames.QuicFrame.getTypeField.

Returns the type field that was / should be encoded. This is the frame type with possibly some additional bits set, depending on the frame.

Annotations
@Override
hasLengthback to summary
public boolean hasLength()

Returns whether this frame has a length. A frame that doesn't have a length must be the last frame in the packet.

Returns:boolean

whether this frame has a length

headerSizeback to summary
public static int headerSize(QuicPacketEncoder encoder, long streamId, long offset, long length)

Computes the header size that would be required to encode a frame with the given streamId, offset, and length.

API Note

This method is useful to figure out how many bytes can be allocated for the frame data, given a size constraint imposed by the space available for the whole datagram payload.

Parameters
encoder:QuicPacketEncoder

the QuicPacketEncoder - which can be used in case some part of the computation is Quic-version dependent.

streamId:long

the stream id

offset:long

the stream offset

length:long

the estimated length of the frame, typically this will be the min between the data available in the stream with respect to flow control, and the maximum remaining size for the datagram payload

Returns:int

the estimated size of the header for a StreamFrame that would be created with the given parameters.

isLastback to summary
public boolean isLast()

Returns true if this is the last frame in the stream. The last frame has the FIN bit set.

Returns:boolean

true if this is the last frame in the stream

offsetback to summary
public long offset()

Returns the frame offset.

Returns:long

the frame offset

payloadback to summary
public ByteBuffer payload()

Returns the frame payload.

Returns:ByteBuffer

the frame payload

sizeback to summary
public int size()

Implements abstract jdk.internal.net.http.quic.frames.QuicFrame.size.

Doc from jdk.internal.net.http.quic.frames.QuicFrame.size.

Returns the minimum number of bytes needed to encode this frame.

Annotations
@Override
sliceback to summary
public StreamFrame slice(long offset, int length)

Creates a new StreamFrame which is a slice of this stream frame.

Parameters
offset:long

the new offset

length:int

the new length

Returns:StreamFrame

a slice of the current stream frame

Exceptions
IndexOutOfBoundsException:
if the offset or length exceed the bounds of this stream frame
streamIdback to summary
public long streamId()

Returns the stream id.

Returns:long

the stream id

toStringback to summary
public String toString()

Overrides jdk.internal.net.http.quic.frames.QuicFrame.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