Package io.github.mahmoudimus.quic.frame
Record Class Frame.ConnectionClose
java.lang.Object
java.lang.Record
io.github.mahmoudimus.quic.frame.Frame.ConnectionClose
- Record Components:
errorCode- the transport error codeframeType- the type of the frame that caused the error, or 0 if unknownreason- the reason phrase, UTF-8 by convention
- All Implemented Interfaces:
Frame
- Enclosing interface:
Frame
public static record Frame.ConnectionClose(long errorCode, long frameType, ByteBuffer reason)
extends Record
implements Frame
A CONNECTION_CLOSE frame for a transport error (type 0x1c).
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.mahmoudimus.quic.frame.Frame
Frame.Ack, Frame.AckFrequency, Frame.AckRange, Frame.ApplicationClose, Frame.ConnectionClose, Frame.Crypto, Frame.DataBlocked, Frame.Datagram, Frame.EcnCounts, Frame.HandshakeDone, Frame.ImmediateAck, Frame.MaxData, Frame.MaxStreamData, Frame.MaxStreams, Frame.NewConnectionId, Frame.NewToken, Frame.Padding, Frame.PathChallenge, Frame.PathResponse, Frame.Ping, Frame.ResetStream, Frame.RetireConnectionId, Frame.StopSending, Frame.Stream, Frame.StreamDataBlocked, Frame.StreamsBlocked -
Field Summary
Fields inherited from interface io.github.mahmoudimus.quic.frame.Frame
MAX_STREAM_COUNT -
Constructor Summary
ConstructorsConstructorDescriptionConnectionClose(long errorCode, long frameType, ByteBuffer reason) A transport CONNECTION_CLOSE frame. -
Method Summary
Modifier and TypeMethodDescriptionvoidencode(ByteBuffer out) Writes the frame at the buffer's position.booleanencode(ByteBuffer out, int budget) Writes the frame, truncating the reason phrase to fit a byte budget, as quinn does.intThe encoded length.final booleanIndicates whether some other object is "equal to" this one.longReturns the value of theerrorCoderecord component.longReturns the value of theframeTyperecord component.final inthashCode()Returns a hash code value for this object.static Frame.ConnectionCloseA transport CONNECTION_CLOSE frame with a text reason.reason()The reason phrase.The reason phrase as text.final StringtoString()Returns a string representation of this record class.type()The frame type.longtypeCode()The exact type code this frame encodes with, flags included.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.github.mahmoudimus.quic.frame.Frame
isAckEliciting
-
Constructor Details
-
ConnectionClose
A transport CONNECTION_CLOSE frame.- Parameters:
errorCode- the transport error codeframeType- the type of the offending frame, or 0reason- the reason phrase between its position and limit
-
-
Method Details
-
of
A transport CONNECTION_CLOSE frame with a text reason.- Parameters:
errorCode- the transport error codeframeType- the type of the offending frame, or 0reason- the reason phrase- Returns:
- the frame
-
reason
The reason phrase.- Returns:
- an independent view of the reason bytes
-
reasonPhrase
The reason phrase as text.- Returns:
- the reason decoded as UTF-8, with malformed bytes replaced
-
encode
Writes the frame, truncating the reason phrase to fit a byte budget, as quinn does.- Parameters:
out- the buffer, written at its positionbudget- the most bytes the frame may take (also bounded byout.remaining())- Returns:
- false if not even an empty reason fits, in which case nothing is written
-
type
Description copied from interface:FrameThe frame type. -
typeCode
public long typeCode()Description copied from interface:FrameThe exact type code this frame encodes with, flags included. -
encodedLength
public int encodedLength()Description copied from interface:FrameThe encoded length.- Specified by:
encodedLengthin interfaceFrame- Returns:
- the bytes
Frame.encode(java.nio.ByteBuffer)writes
-
encode
Description copied from interface:FrameWrites the frame at the buffer's position. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
errorCode
public long errorCode()Returns the value of theerrorCoderecord component.- Returns:
- the value of the
errorCoderecord component
-
frameType
public long frameType()Returns the value of theframeTyperecord component.- Returns:
- the value of the
frameTyperecord component
-