public BitStream(Stream stream, StreamState initialState, bool leaveOpen = false) { Contract.Requires <ArgumentNullException>(stream != null); Contract.Requires(initialState.IsDefined()); _reader = new Lazy <BitReader>(() => new BitReader(stream, leaveOpen)); _writer = new Lazy <BitWriter>(() => new BitWriter(stream, leaveOpen)); _state = initialState; }
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; }