Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Http3Frame.cs
Go to the documentation of this file.
1namespace System.Net.Http;
2
3internal static class Http3Frame
4{
5 public static bool TryReadIntegerPair(ReadOnlySpan<byte> buffer, out long a, out long b, out int bytesRead)
6 {
7 if (VariableLengthIntegerHelper.TryRead(buffer, out a, out var bytesRead2))
8 {
9 buffer = buffer.Slice(bytesRead2);
10 if (VariableLengthIntegerHelper.TryRead(buffer, out b, out var bytesRead3))
11 {
12 bytesRead = bytesRead2 + bytesRead3;
13 return true;
14 }
15 }
16 b = 0L;
17 bytesRead = 0;
18 return false;
19 }
20
21 public static bool TryWriteFrameEnvelope(Http3FrameType frameType, long payloadLength, Span<byte> buffer, out int bytesWritten)
22 {
23 if (buffer.Length != 0)
24 {
25 buffer[0] = (byte)frameType;
26 buffer = buffer.Slice(1);
27 if (VariableLengthIntegerHelper.TryWrite(buffer, payloadLength, out var bytesWritten2))
28 {
29 bytesWritten = bytesWritten2 + 1;
30 return true;
31 }
32 }
33 bytesWritten = 0;
34 return false;
35 }
36}
static bool TryWriteFrameEnvelope(Http3FrameType frameType, long payloadLength, Span< byte > buffer, out int bytesWritten)
Definition Http3Frame.cs:21
static bool TryReadIntegerPair(ReadOnlySpan< byte > buffer, out long a, out long b, out int bytesRead)
Definition Http3Frame.cs:5
static bool TryRead(ReadOnlySpan< byte > buffer, out long value, out int bytesRead)
static bool TryWrite(Span< byte > buffer, long longToEncode, out int bytesWritten)