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

◆ BinaryReader() [3/3]

System.IO.BinaryReader.BinaryReader ( Stream input,
Encoding encoding,
bool leaveOpen )
inline

Definition at line 41 of file BinaryReader.cs.

42 {
43 if (input == null)
44 {
45 throw new ArgumentNullException("input");
46 }
47 if (encoding == null)
48 {
49 throw new ArgumentNullException("encoding");
50 }
51 if (!input.CanRead)
52 {
53 throw new ArgumentException(SR.Argument_StreamNotReadable);
54 }
55 _stream = input;
56 _decoder = encoding.GetDecoder();
57 _maxCharsSize = encoding.GetMaxCharCount(128);
58 int num = encoding.GetMaxByteCount(1);
59 if (num < 16)
60 {
61 num = 16;
62 }
63 _buffer = new byte[num];
64 _2BytesPerChar = encoding is UnicodeEncoding;
65 _isMemoryStream = _stream.GetType() == typeof(MemoryStream);
66 _leaveOpen = leaveOpen;
67 }
readonly bool _leaveOpen
readonly Decoder _decoder
readonly Stream _stream
readonly bool _2BytesPerChar
readonly int _maxCharsSize
readonly bool _isMemoryStream
readonly byte[] _buffer
int GetMaxCharCount(int byteCount)
int GetMaxByteCount(int charCount)
virtual Decoder GetDecoder()
Definition Encoding.cs:1004

References System.IO.BinaryReader._2BytesPerChar, System.IO.BinaryReader._buffer, System.IO.BinaryReader._decoder, System.IO.BinaryReader._isMemoryStream, System.IO.BinaryReader._leaveOpen, System.IO.BinaryReader._maxCharsSize, System.IO.BinaryReader._stream, System.SR.Argument_StreamNotReadable, System.Text.Encoding.GetDecoder(), System.Text.Encoding.GetMaxByteCount(), System.Text.Encoding.GetMaxCharCount(), and System.input.