Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ EncodeValueString() [2/2]

static bool System.Net.Http.QPack.QPackEncoder.EncodeValueString ( string s,
Encoding valueEncoding,
Span< byte > buffer,
out int length )
inlinestaticprivate

Definition at line 114 of file QPackEncoder.cs.

115 {
116 if (buffer.Length != 0)
117 {
118 buffer[0] = 0;
119 int num = ((valueEncoding == null || valueEncoding == Encoding.Latin1) ? s.Length : valueEncoding.GetByteCount(s));
120 if (IntegerEncoder.Encode(num, 7, buffer, out var bytesWritten))
121 {
122 buffer = buffer.Slice(bytesWritten);
123 if (buffer.Length >= num)
124 {
125 if (valueEncoding == null)
126 {
128 }
129 else
130 {
131 int bytes = valueEncoding.GetBytes(s, buffer);
132 }
133 length = bytesWritten + num;
134 return true;
135 }
136 }
137 }
138 length = 0;
139 return false;
140 }
static bool Encode(int value, int numBits, Span< byte > destination, out int bytesWritten)
static void EncodeValueStringPart(string s, Span< byte > buffer)
static Encoding Latin1
Definition Encoding.cs:513
virtual byte[] GetBytes(char[] chars)
Definition Encoding.cs:781

References System.buffer, System.bytes, System.Net.Http.HPack.IntegerEncoder.Encode(), System.Net.Http.QPack.QPackEncoder.EncodeValueStringPart(), System.Text.Encoding.GetByteCount(), System.Text.Encoding.GetBytes(), System.Text.Encoding.Latin1, System.length, and System.s.

Referenced by System.Net.Http.Http3RequestStream.BufferLiteralHeaderValues(), System.Net.Http.QPack.QPackEncoder.EncodeLiteralHeaderFieldWithoutNameReference(), System.Net.Http.QPack.QPackEncoder.EncodeLiteralHeaderFieldWithoutNameReference(), System.Net.Http.QPack.QPackEncoder.EncodeLiteralHeaderFieldWithStaticNameReference(), and System.Net.Http.QPack.QPackEncoder.EncodeValueString().