public BitStream(StorageContainer storageContainer, string fileName, BitStreamMode mode)
        {
            if (mode == BitStreamMode.Read)
            {
                _stream = storageContainer.OpenFile(fileName, FileMode.Open);
            }
            else
            {
                _stream = storageContainer.OpenFile(fileName, FileMode.OpenOrCreate);
            }

            _outBytes = new List <byte>();
            _mode     = mode;
            _numRead  = 0;
            _counter  = 0;
        }
Beispiel #2
0
 public BitStream(Stream stream_1, BitStreamMode bitStreamMode1)
 {
     this.mode   = bitStreamMode1;
     this.stream = stream_1;
     if (!((bitStreamMode1 != BitStreamMode.Read) || stream_1.CanRead))
     {
         throw new ArgumentException("Can't read from the underlying stream.");
     }
     if (!((bitStreamMode1 != BitStreamMode.Write) || stream_1.CanWrite))
     {
         throw new ArgumentException("Can't write to the underlying stream.");
     }
     this.byte_0   = 0;
     this.int_0    = 0;
     this.position = 0L;
     this.bool_0   = true;
     this.bool_1   = true;
 }
Beispiel #3
0
        public BitStream(Stream stream, BitStreamMode fileAccess)
        {
            _stream     = stream;
            _fileAccess = fileAccess;

            switch (fileAccess)
            {
            case BitStreamMode.GF_BITSTREAM_READ:
                _nbBits  = 8;
                _current = 0;
                _reader  = new BinaryReader(_stream);
                break;

            case BitStreamMode.GF_BITSTREAM_WRITE:
                _writer = new BinaryWriter(_stream);
                _nbBits = 0;
                break;
            }
        }