(WriteContext context, string value)
| 114 | } |
| 115 | |
| 116 | private static void WriteLatin1(WriteContext context, string value) |
| 117 | { |
| 118 | int byteLength = value.Length; |
| 119 | if (byteLength == 0) |
| 120 | { |
| 121 | context.Writer.WriteUInt8((byte)ForyStringEncoding.Latin1); |
| 122 | return; |
| 123 | } |
| 124 | |
| 125 | ulong header = ((ulong)byteLength << 2) | (ulong)ForyStringEncoding.Latin1; |
| 126 | Span<byte> headerBuf = stackalloc byte[MaxVarUInt36SmallBytes]; |
| 127 | int headerBytes = EncodeVarUInt36Small(headerBuf, header); |
| 128 | Span<byte> destination = context.Writer.GetSpan(headerBytes + byteLength); |
| 129 | headerBuf.Slice(0, headerBytes).CopyTo(destination); |
| 130 | int written = Encoding.Latin1.GetBytes(value.AsSpan(), destination.Slice(headerBytes)); |
| 131 | context.Writer.Advance(headerBytes + written); |
| 132 | } |
| 133 | |
| 134 | private static void WriteUtf8(WriteContext context, string value) |
| 135 | { |
nothing calls this directly
no test coverage detected