public EndianBinaryWriter(EndianBitConverter bitConverter, Stream stream, Encoding encoding) { if (bitConverter == null) { throw new ArgumentNullException(nameof(bitConverter)); } if (stream == null) { throw new ArgumentNullException(nameof(stream)); } if (encoding == null) { throw new ArgumentNullException(nameof(encoding)); } if (!stream.CanWrite) { throw new ArgumentException("Cannot write to stream", nameof(stream)); } BaseStream = stream; BitConverter = bitConverter; Encoding = encoding; }
public EndianBinaryReader(EndianBitConverter bitConverter, Stream stream, Encoding encoding) { if (bitConverter == null){ throw new ArgumentNullException(nameof(bitConverter)); } if (stream == null){ throw new ArgumentNullException(nameof(stream)); } if (encoding == null){ throw new ArgumentNullException(nameof(encoding)); } if (!stream.CanRead){ throw new ArgumentException("Stream is not writable", nameof(stream)); } BaseStream = stream; BitConverter = bitConverter; Encoding = encoding; decoder = encoding.GetDecoder(); minBytesPerChar = 1; if (encoding is UnicodeEncoding){ minBytesPerChar = 2; } }
public EndianBinaryReader(EndianBitConverter bitConverter, Stream stream) : this(bitConverter, stream, Encoding.UTF8) { }
public EndianBinaryWriter(EndianBitConverter bitConverter, Stream stream) : this(bitConverter, stream, Encoding.UTF8) { }