private void Init(Stream stream, O5MHeader header = O5MHeader.O5M2) { this._stream = stream; this._stream.WriteByte((byte)O5MFileByteMarker.StartByte); this._stream.WriteByte((byte)O5MFileByteMarker.Header); var headerLengthBytes = VarintBitConverter.GetVarintBytes(4U); var headerBuffer = Encoding.UTF8.GetBytes(header.ToString().ToLower()); this._stream.Write(headerLengthBytes, 0, headerLengthBytes.Length); this._stream.Write(headerBuffer, 0, headerBuffer.Length); }
/// <summary> /// Initializes a new instance of the <see cref="T:O5M.O5MWriter"/> class. /// </summary> /// <param name="stream">Stream.</param> /// <param name="header">Header.</param> public O5MWriter(Stream stream, O5MHeader header = O5MHeader.O5M2) { this.Init(stream, header); }
/// <summary> /// Initializes a new instance of the <see cref="T:O5M.O5MWriter"/> class. /// </summary> /// <param name="filename">Filename.</param> /// <param name="header">Header.</param> public O5MWriter(string filename, O5MHeader header = O5MHeader.O5M2) { this.Init(File.OpenWrite(filename), header); }