31 private static readonly
byte[]
s_encodingAttr =
new byte[8] { 101, 110, 99, 111, 100, 105, 110, 103 };
33 private static readonly
byte[]
s_encodingUTF8 =
new byte[5] { 117, 116, 102, 45, 56 };
35 private static readonly
byte[]
s_encodingUnicode =
new byte[6] { 117, 116, 102, 45, 49, 54 };
37 private static readonly
byte[]
s_encodingUnicodeLE =
new byte[8] { 117, 116, 102, 45, 49, 54, 108, 101 };
39 private static readonly
byte[]
s_encodingUnicodeBE =
new byte[8] { 117, 116, 102, 45, 49, 54, 98, 101 };
216 if (encoding ==
null)
296 if (
b1 == 60 &&
b2 != 0)
301 else if (
b1 ==
byte.MaxValue &&
b2 == 254)
306 else if (
b1 == 254 &&
b2 ==
byte.MaxValue)
311 else if (
b1 == 0 &&
b2 == 60)
320 else if (
b1 == 60 &&
b2 == 0)
329 else if (
b1 == 239 &&
b2 == 187)
491 for (
int i = 0; i <
key.Length; i++)
503 for (
int i = 0; i <
key.Length; i++)
515 if (
ch != 32 &&
ch != 10 &&
ch != 9)
static void BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count)
int Read(byte[] buffer, int offset, int count)
void Write(byte[] buffer, int offset, int count)
virtual void WriteByte(byte value)
static byte Min(byte val1, byte val2)
static string XmlDeclarationRequired
static string XmlMalformedDecl
static string XmlInvalidBytes
static string UnexpectedEndOfFile
static string Format(string resourceFormat, object p1)
static string XmlEncodingMismatch
static string XmlEncodingNotSupported
static string XmlDeclMissing
static string XmlExpectedEncoding
int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush)
virtual ReadOnlySpan< byte > Preamble
virtual Encoder GetEncoder()
virtual char[] GetChars(byte[] bytes)
static bool IsWhitespace(byte ch)
static Encoding GetSafeEncoding(SupportedEncoding e)
static void CheckUTF8DeclarationEncoding(byte[] buffer, int offset, int count, SupportedEncoding e, SupportedEncoding expectedEnc)
static readonly UnicodeEncoding s_safeUTF16
static readonly byte[] s_encodingUnicodeLE
readonly byte[] _byteBuffer
static ArraySegment< byte > ProcessBuffer(byte[] buffer, int offset, int count, Encoding encoding)
static void ThrowExpectedEncodingMismatch(SupportedEncoding expEnc, SupportedEncoding actualEnc)
static bool CompareCaseInsensitive(byte[] key, byte[] buffer, int offset)
static readonly byte[] s_encodingAttr
override long Seek(long offset, SeekOrigin origin)
static string GetEncodingName(SupportedEncoding enc)
override void WriteByte(byte b)
static void ThrowEncodingMismatch(string declEnc, SupportedEncoding enc)
static readonly byte[] s_encodingUnicodeBE
void FillBuffer(int count)
SupportedEncoding _encodingCode
static readonly UnicodeEncoding s_validatingUTF16
SupportedEncoding ReadBOMEncoding(bool notOutOfBand)
static Encoding GetEncoding(SupportedEncoding e)
static readonly UnicodeEncoding s_safeBEUTF16
static bool Compare(byte[] key, byte[] buffer, int offset)
override void Write(byte[] buffer, int offset, int count)
void SetReadDocumentEncoding(SupportedEncoding e)
static readonly byte[] s_encodingUTF8
static readonly UTF8Encoding s_validatingUTF8
static readonly byte[] s_encodingUnicode
static void ThrowEncodingMismatch(string declEnc, string docEnc)
static SupportedEncoding GetSupportedEncoding(Encoding encoding)
static SupportedEncoding ReadBOMEncoding(byte b1, byte b2, byte b3, byte b4, bool notOutOfBand, out int preserve)
override int WriteTimeout
override void SetLength(long value)
override int Read(byte[] buffer, int offset, int count)
EncodingStreamWrapper(Stream stream, Encoding encoding)
override void Dispose(bool disposing)
static readonly UTF8Encoding s_safeUTF8
static readonly UnicodeEncoding s_validatingBEUTF16
EncodingStreamWrapper(Stream stream, Encoding encoding, bool emitBOM)