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; }
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; }