private void Dispose(bool disposing)
        {
            if (IsDisposed)
                return; // Done already, so nothing left to do.

            if (disposing)
            {
                if (_input != null)
                    _input.Close();
                _input = null;
            }

            // Dispose unmanaged resources here, whether disposing is true or false.

            // Main data members.

            IsDisposed = true;
        }
        /// <summary>
        /// Return the second level elements that are in the input file, including an optional first element.
        /// </summary>
        public IEnumerable<byte[]> GetSecondLevelElementBytes(string firstElementMarker, string recordMarker)
        {
            if (string.IsNullOrEmpty(recordMarker)) throw new ArgumentException("Null or empty string", "recordMarker");
            _input = new AsyncFileReader(_pathname);
            InitializeOffsets();
            var recordMarkerAsBytes = FormatRecordMarker(recordMarker);
            if (firstElementMarker != null && _currentOffset < _endOfRecordsOffset)
            {
                var firstElementMarkerAsBytes = FormatRecordMarker(firstElementMarker);
                if (MatchMarker(firstElementMarkerAsBytes))
                {
                    yield return MakeElement(firstElementMarkerAsBytes);
                    AdvanceToOpenAngleBracket();
                }
            }

            // We've processed the special first element if any and should be at the first record marker (or end of file)
            while (_currentOffset < _endOfRecordsOffset)
            {
                if (!MatchMarker(recordMarkerAsBytes))
                {
                    var msg = string.Format("Can't find{0} main record with element name '{1}'",
                        firstElementMarker == null ? "" : string.Format(" optional element name '{0}' or", firstElementMarker),
                        recordMarker);
                    throw new ArgumentException(msg);
                }
                yield return MakeElement(recordMarkerAsBytes);
                AdvanceToOpenAngleBracket();
            }
            _input.Close();
            _input = null;
        }