/// <summary> /// Creates an instance with the specified properties /// </summary> /// <param name="source">The source <see cref="System.IO.Stream"/></param> /// <param name="bitOrder">The <see cref="Binary.BitOrder"/></param> /// <param name="bitIndex">Starting bit offset</param> /// <param name="byteIndex">Starting byte offset</param> /// <param name="writable">Indicates if the bytes should allow writing past the end</param> /// <param name="cacheSize">Cache array size</param> /// <param name="leaveOpen">Indicates if Dispose will close the stream</param> public BitReader(byte[] source, Binary.BitOrder bitOrder, int bitIndex, int byteIndex, bool writable, int cacheSize = 32, bool leaveOpen = false) : this(new System.IO.MemoryStream(source, writable), bitOrder, cacheSize, leaveOpen) { m_BitIndex = bitIndex; m_ByteIndex = byteIndex; }
/// <summary> /// /// </summary> /// <param name="buffer"></param> /// <param name="writable"></param> /// <param name="bitOrder"></param> /// <param name="cacheSize"></param> /// <param name="leaveOpen"></param> public BitWriter(byte[] buffer, bool writable, Common.Binary.BitOrder bitOrder, int cacheSize = 32, bool leaveOpen = false) : base(true) { m_BaseStream = new System.IO.MemoryStream(buffer, writable); m_LeaveOpen = leaveOpen; m_ByteCache = new MemorySegment(buffer); m_BitOrder = bitOrder; }
/// <summary> /// Creates an instance with the specified properties /// </summary> /// <param name="source">The source <see cref="System.IO.Stream"/></param> /// <param name="bitOrder">The <see cref="Binary.BitOrder"/></param> /// <param name="cacheSize">Cache array size</param> /// <param name="leaveOpen">Indicates if Dispose will close the stream</param> public BitReader(System.IO.Stream source, Binary.BitOrder bitOrder, int cacheSize = 32, bool leaveOpen = false) : base(true) { if (source == null) { throw new System.ArgumentNullException("source"); } m_BaseStream = source; m_LeaveOpen = leaveOpen; m_ByteCache = new MemorySegment(cacheSize); m_BitOrder = bitOrder; }