Esempio n. 1
0
        public BinaryWriter(Stream output, ByteOrder endianness = ByteOrder.Default, bool leaveOpen = false)
        {
            Contract.Requires(output != null);
            Contract.Requires(endianness.IsDefined());

            _stream     = output;
            _endianness = endianness;
            _leaveOpen  = leaveOpen;
        }
Esempio n. 2
0
        public BinaryStream(Stream stream, StreamState initialState, ByteOrder endianness = ByteOrder.Default, bool leaveOpen = false)
        {
            Contract.Requires <ArgumentNullException>(stream != null);
            Contract.Requires(initialState.IsDefined() && endianness.IsDefined());

            _reader = new Lazy <BinaryReader>(() => new BinaryReader(stream, endianness, leaveOpen));
            _writer = new Lazy <BinaryWriter>(() => new BinaryWriter(stream, endianness, leaveOpen));
            _state  = initialState;
            _stream = stream;
        }