コード例 #1
0
 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;
 }
コード例 #2
0
 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;
     }
 }
コード例 #3
0
 public EndianBinaryReader(EndianBitConverter bitConverter, Stream stream)
     : this(bitConverter, stream, Encoding.UTF8)
 {
 }
コード例 #4
0
 public EndianBinaryWriter(EndianBitConverter bitConverter, Stream stream) : this(bitConverter, stream, Encoding.UTF8)
 {
 }