Read RANGEPROTECTION record
Reading of this record is based on Microsoft Office Excel 97-2000 Binary File Format Specification,
where it is referred to as FEAT record
486650
private function _readRangeProtection()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		// local pointer in record data
		$offset = 0;

		if (!$this->_readDataOnly) {
			$offset += 12;

			// offset: 12; size: 2; shared feature type, 2 = enhanced protection, 4 = smart tag
			$isf = self::_GetInt2d($recordData, 12);
			if ($isf != 2) {
				// we only read FEAT records of type 2
				return;
			}
			$offset += 2;

			$offset += 5;

			// offset: 19; size: 2; count of ref ranges this feature is on
			$cref = self::_GetInt2d($recordData, 19);
			$offset += 2;

			$offset += 6;

			// offset: 27; size: 8 * $cref; list of cell ranges (like in hyperlink record)
			$cellRanges = array();
			for ($i = 0; $i < $cref; ++$i) {
				try {
					$cellRange = $this->_readBIFF8CellRangeAddressFixed(substr($recordData, 27 + 8 * $i, 8));
				} catch (PHPExcel_Exception $e) {
					return;
				}
				$cellRanges[] = $cellRange;
				$offset += 8;
			}

			// offset: var; size: var; variable length of feature specific data
			$rgbFeat = substr($recordData, $offset);
			$offset += 4;

			// offset: var; size: 4; the encrypted password (only 16-bit although field is 32-bit)
			$wPassword = self::_GetInt4d($recordData, $offset);
			$offset += 4;

			// Apply range protection to sheet
			if ($cellRanges) {
				$this->_phpSheet->protectCells(implode(' ', $cellRanges), strtoupper(dechex($wPassword)), true);
			}
		}
	}
26876
private function _readHorizontalPageBreaks()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = substr($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) {

			// offset: 0; size: 2; number of the following row index structures
			$nm = self::_GetInt2d($recordData, 0);

			// offset: 2; size: 6 * $nm; list of $nm row index structures
			for ($i = 0; $i < $nm; ++$i) {
				$r = self::_GetInt2d($recordData, 2 + 6 * $i);
				$cf = self::_GetInt2d($recordData, 2 + 6 * $i + 2);
				$cl = self::_GetInt2d($recordData, 2 + 6 * $i + 4);

				// not sure why two column indexes are necessary?
				$this->_phpSheet->setBreakByColumnAndRow($cf, $r, PHPExcel_Worksheet::BREAK_ROW);
			}
		}
	}
191173
private function _readSheetProtection()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		if ($this->_readDataOnly) {
			return;
		}

		// offset: 0; size: 2; repeated record header

		// offset: 2; size: 2; FRT cell reference flag (=0 currently)

		// offset: 4; size: 8; Currently not used and set to 0

		// offset: 12; size: 2; Shared feature type index (2=Enhanced Protetion, 4=SmartTag)
		$isf = self::_GetInt2d($recordData, 12);
		if ($isf != 2) {
			return;
		}

		// offset: 14; size: 1; =1 since this is a feat header

		// offset: 15; size: 4; size of rgbHdrSData

		// rgbHdrSData, assume "Enhanced Protection"
		// offset: 19; size: 2; option flags
		$options = self::_GetInt2d($recordData, 19);

		// bit: 0; mask 0x0001; 1 = user may edit objects, 0 = users must not edit objects
		$bool = (0x0001 & $options) >> 0;
		$this->_phpSheet->getProtection()->setObjects(!$bool);

		// bit: 1; mask 0x0002; edit scenarios
		$bool = (0x0002 & $options) >> 1;
		$this->_phpSheet->getProtection()->setScenarios(!$bool);

		// bit: 2; mask 0x0004; format cells
		$bool = (0x0004 & $options) >> 2;
		$this->_phpSheet->getProtection()->setFormatCells(!$bool);

		// bit: 3; mask 0x0008; format columns
		$bool = (0x0008 & $options) >> 3;
		$this->_phpSheet->getProtection()->setFormatColumns(!$bool);

		// bit: 4; mask 0x0010; format rows
		$bool = (0x0010 & $options) >> 4;
		$this->_phpSheet->getProtection()->setFormatRows(!$bool);

		// bit: 5; mask 0x0020; insert columns
		$bool = (0x0020 & $options) >> 5;
		$this->_phpSheet->getProtection()->setInsertColumns(!$bool);

		// bit: 6; mask 0x0040; insert rows
		$bool = (0x0040 & $options) >> 6;
		$this->_phpSheet->getProtection()->setInsertRows(!$bool);

		// bit: 7; mask 0x0080; insert hyperlinks
		$bool = (0x0080 & $options) >> 7;
		$this->_phpSheet->getProtection()->setInsertHyperlinks(!$bool);

		// bit: 8; mask 0x0100; delete columns
		$bool = (0x0100 & $options) >> 8;
		$this->_phpSheet->getProtection()->setDeleteColumns(!$bool);

		// bit: 9; mask 0x0200; delete rows
		$bool = (0x0200 & $options) >> 9;
		$this->_phpSheet->getProtection()->setDeleteRows(!$bool);

		// bit: 10; mask 0x0400; select locked cells
		$bool = (0x0400 & $options) >> 10;
		$this->_phpSheet->getProtection()->setSelectLockedCells(!$bool);

		// bit: 11; mask 0x0800; sort cell range
		$bool = (0x0800 & $options) >> 11;
		$this->_phpSheet->getProtection()->setSort(!$bool);

		// bit: 12; mask 0x1000; auto filter
		$bool = (0x1000 & $options) >> 12;
		$this->_phpSheet->getProtection()->setAutoFilter(!$bool);

		// bit: 13; mask 0x2000; pivot tables
		$bool = (0x2000 & $options) >> 13;
		$this->_phpSheet->getProtection()->setPivotTables(!$bool);

		// bit: 14; mask 0x4000; select unlocked cells
		$bool = (0x4000 & $options) >> 14;
		$this->_phpSheet->getProtection()->setSelectUnlockedCells(!$bool);

		// offset: 21; size: 2; not used
	}
99993
private function _readClientAnchor()
	{
		$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
		$recordData = substr($this->_data, $this->_pos + 8, $length);

		// move stream pointer to next record
		$this->_pos += 8 + $length;

		// offset: 2; size: 2; upper-left corner column index (0-based)
		$c1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 2);

		// offset: 4; size: 2; upper-left corner horizontal offset in 1/1024 of column width
		$startOffsetX = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 4);

		// offset: 6; size: 2; upper-left corner row index (0-based)
		$r1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 6);

		// offset: 8; size: 2; upper-left corner vertical offset in 1/256 of row height
		$startOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 8);

		// offset: 10; size: 2; bottom-right corner column index (0-based)
		$c2 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 10);

		// offset: 12; size: 2; bottom-right corner horizontal offset in 1/1024 of column width
		$endOffsetX = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 12);

		// offset: 14; size: 2; bottom-right corner row index (0-based)
		$r2 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 14);

		// offset: 16; size: 2; bottom-right corner vertical offset in 1/256 of row height
		$endOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 16);

		// set the start coordinates
		$this->_object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1));

		// set the start offsetX
		$this->_object->setStartOffsetX($startOffsetX);

		// set the start offsetY
		$this->_object->setStartOffsetY($startOffsetY);

		// set the end coordinates
		$this->_object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1));

		// set the end offsetX
		$this->_object->setEndOffsetX($endOffsetX);

		// set the end offsetY
		$this->_object->setEndOffsetY($endOffsetY);
	}
17131
private function _readExternalBook()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		// offset within record data
		$offset = 0;

		// there are 4 types of records
		if (strlen($recordData) > 4) {
			// external reference
			// offset: 0; size: 2; number of sheet names ($nm)
			$nm = self::_GetInt2d($recordData, 0);
			$offset += 2;

			// offset: 2; size: var; encoded URL without sheet name (Unicode string, 16-bit length)
			$encodedUrlString = self::_readUnicodeStringLong(substr($recordData, 2));
			$offset += $encodedUrlString['size'];

			// offset: var; size: var; list of $nm sheet names (Unicode strings, 16-bit length)
			$externalSheetNames = array();
			for ($i = 0; $i < $nm; ++$i) {
				$externalSheetNameString = self::_readUnicodeStringLong(substr($recordData, $offset));
				$externalSheetNames[] = $externalSheetNameString['value'];
				$offset += $externalSheetNameString['size'];
			}

			// store the record data
			$this->_externalBooks[] = array(
				'type' => 'external',
				'encodedUrl' => $encodedUrlString['value'],
				'externalSheetNames' => $externalSheetNames,
			);

		} elseif (substr($recordData, 2, 2) == pack('CC', 0x01, 0x04)) {
			// internal reference
			// offset: 0; size: 2; number of sheet in this document
			// offset: 2; size: 2; 0x01 0x04
			$this->_externalBooks[] = array(
				'type' => 'internal',
			);
		} elseif (substr($recordData, 0, 4) == pack('vCC', 0x0001, 0x01, 0x3A)) {
			// add-in function
			// offset: 0; size: 2; 0x0001
			$this->_externalBooks[] = array(
				'type' => 'addInFunction',
			);
		} elseif (substr($recordData, 0, 2) == pack('v', 0x0000)) {
			// DDE links, OLE links
			// offset: 0; size: 2; 0x0000
			// offset: 2; size: var; encoded source document name
			$this->_externalBooks[] = array(
				'type' => 'DDEorOLE',
			);
		}
	}
65698
private function _readBstoreContainer()
	{
		$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
		$recordData = substr($this->_data, $this->_pos + 8, $length);

		// move stream pointer to next record
		$this->_pos += 8 + $length;

		// record is a container, read contents
		$bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer();
		$this->_object->setBstoreContainer($bstoreContainer);
		$reader = new PHPExcel_Reader_Excel5_Escher($bstoreContainer);
		$reader->load($recordData);
	}
386323
private function _readBlank()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		// offset: 0; size: 2; row index
		$row = self::_GetInt2d($recordData, 0);

		// offset: 2; size: 2; col index
		$col = self::_GetInt2d($recordData, 2);
		$columnString = PHPExcel_Cell::stringFromColumnIndex($col);

		// Read cell?
		if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
			// offset: 4; size: 2; XF index
			$xfIndex = self::_GetInt2d($recordData, 4);

			// add style information
			if (!$this->_readDataOnly) {
				$this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfIndex]);
			}
		}

	}
117441
public int putRawRecordData(Rec record)
    {
        int iErrorCode = super.putRawRecordData(record);
        this.putRawFieldData(record.getField(UserInfo.USER_NAME));
        this.putRawFieldData(record.getField(UserInfo.PASSWORD));
        return iErrorCode;
    }
56009
private function readHorizontalPageBreaks()
    {
        $length = self::getInt2d($this->data, $this->pos + 2);
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);

        // move stream pointer to next record
        $this->pos += 4 + $length;

        if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) {
            // offset: 0; size: 2; number of the following row index structures
            $nm = self::getInt2d($recordData, 0);

            // offset: 2; size: 6 * $nm; list of $nm row index structures
            for ($i = 0; $i < $nm; ++$i) {
                $r = self::getInt2d($recordData, 2 + 6 * $i);
                $cf = self::getInt2d($recordData, 2 + 6 * $i + 2);
                $cl = self::getInt2d($recordData, 2 + 6 * $i + 4);

                // not sure why two column indexes are necessary?
                $this->phpSheet->setBreakByColumnAndRow($cf, $r, PHPExcel_Worksheet::BREAK_ROW);
            }
        }
    }
345514
def _read_arc_record(self):
        ""
        #XXX:Noufal Stream payload here rather than just read it
        # r = self.fileobj.readline() # Drop the initial newline
        # if r == "":
        #     return None
        # header = self.fileobj.readline()

        # Strip the initial new lines and read first line
        header = self.fileobj.readline()
        while header and header.strip() == "":
            header = self.fileobj.readline()

        if header == "":
            return None

        if int(self.version) == 1:
            arc_header_re = ARC1_HEADER_RE
        elif int(self.version) == 2:
            arc_header_re = ARC2_HEADER_RE

        matches = arc_header_re.search(header)
        headers = matches.groupdict()
        arc_header = ARCHeader(**headers)

        payload = self.fileobj.read(int(headers['length']))

        self.fileobj.readline() # Munge the separator newline.

        return ARCRecord(header = arc_header, payload = payload)
444487
private function readVerticalPageBreaks()
    {
        $length = self::getInt2d($this->data, $this->pos + 2);
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);

        // move stream pointer to next record
        $this->pos += 4 + $length;

        if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) {
            // offset: 0; size: 2; number of the following column index structures
            $nm = self::getInt2d($recordData, 0);

            // offset: 2; size: 6 * $nm; list of $nm row index structures
            for ($i = 0; $i < $nm; ++$i) {
                $c = self::getInt2d($recordData, 2 + 6 * $i);
                $rf = self::getInt2d($recordData, 2 + 6 * $i + 2);
                $rl = self::getInt2d($recordData, 2 + 6 * $i + 4);

                // not sure why two row indexes are necessary?
                $this->phpSheet->setBreakByColumnAndRow($c, $rf, PHPExcel_Worksheet::BREAK_COLUMN);
            }
        }
    }
185800
def _read(self, directory, filename, session, path, name, extension, spatial=None, spatialReferenceID=None, replaceParamFile=None):
        
        # Assign file extension attribute to file object
        self.fileExtension = extension

        timeSeries = []

        # Open file and parse into a data structure
        with open(path, 'r') as f:
            for line in f:
                sline = line.strip().split()

                record = {'time': sline[0],
                          'values': []}

                for idx in range(1, len(sline)):
                    record['values'].append(sline[idx])

                timeSeries.append(record)

        self._createTimeSeriesObjects(timeSeries, filename)
1034285
function readRecord() {
    if (index >= text.length) {
      return EOF;
    }
    var record = [];
    for (var field = readField(); field != EOR; field = readField()) {
      record.push(field);
    }
    return record;
  }
238779
private function _readSpContainer()
	{
		$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
		$recordData = substr($this->_data, $this->_pos + 8, $length);

		// add spContainer to spgrContainer
		$spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
		$this->_object->addChild($spContainer);

		// move stream pointer to next record
		$this->_pos += 8 + $length;

		// record is a container, read contents
		$reader = new PHPExcel_Reader_Excel5_Escher($spContainer);
		$escher = $reader->load($recordData);
	}
1091815
private function readSheetLayout()
    {
        $length = self::getInt2d($this->data, $this->pos + 2);
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);

        // move stream pointer to next record
        $this->pos += 4 + $length;

        // local pointer in record data
        $offset = 0;

        if (!$this->readDataOnly) {
            // offset: 0; size: 2; repeated record identifier 0x0862

            // offset: 2; size: 10; not used

            // offset: 12; size: 4; size of record data
            // Excel 2003 uses size of 0x14 (documented), Excel 2007 uses size of 0x28 (not documented?)
            $sz = self::getInt4d($recordData, 12);

            switch ($sz) {
                case 0x14:
                    // offset: 16; size: 2; color index for sheet tab
                    $colorIndex = self::getInt2d($recordData, 16);
                    $color = self::readColor($colorIndex, $this->palette, $this->version);
                    $this->phpSheet->getTabColor()->setRGB($color['rgb']);
                    break;
                case 0x28:
                    // TODO: Investigate structure for .xls SHEETLAYOUT record as saved by MS Office Excel 2007
                    return;
                    break;
            }
        }
    }
6062
private function _readSheetPr()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = substr($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		// offset: 0; size: 2

		// bit: 6; mask: 0x0040; 0 = outline buttons above outline group
		$isSummaryBelow = (0x0040 & self::_GetInt2d($recordData, 0)) >> 6;
		$this->_phpSheet->setShowSummaryBelow($isSummaryBelow);

		// bit: 7; mask: 0x0080; 0 = outline buttons left of outline group
		$isSummaryRight = (0x0080 & self::_GetInt2d($recordData, 0)) >> 7;
		$this->_phpSheet->setShowSummaryRight($isSummaryRight);

		// bit: 8; mask: 0x100; 0 = scale printout in percent, 1 = fit printout to number of pages
		// this corresponds to radio button setting in page setup dialog in Excel
		$this->_isFitToPages = (bool) ((0x0100 & self::_GetInt2d($recordData, 0)) >> 8);
	}
1286992
def read(self, file_obj):
        
        self.reader = LowLevelReader(file_obj)

        logger_id = [[], None]
        fix_records = [[], []]
        task = [[], {"waypoints": []}]
        dgps_records = [[], []]
        event_records = [[], []]
        satellite_records = [[], []]
        security_records = [[], []]
        header = [[], {}]
        fix_record_extensions = [[], []]
        k_record_extensions = [[], []]
        k_records = [[], []]
        comment_records = [[], []]

        for record_type, line, error in self.reader:

            if record_type == 'A':
                if error:
                    logger_id[0].append(error)
                else:
                    logger_id[1] = line
            elif record_type == 'B':
                if error:
                    if MissingRecordsError not in fix_records[0]:
                        fix_records[0].append(MissingRecordsError)
                else:

                    # add MissingExtensionsError when fix_record_extensions contains error
                    if len(fix_record_extensions[0]) > 0 and MissingExtensionsError not in fix_records[0]:
                        fix_records[0].append(MissingExtensionsError)

                    fix_record = LowLevelReader.process_B_record(line, fix_record_extensions[1])
                    fix_records[1].append(fix_record)
            elif record_type == 'C':
                task_item = line

                if error:
                    if MissingRecordsError not in task[0]:
                        task[0].append(MissingRecordsError)
                else:
                    if task_item['subtype'] == 'task_info':
                        del task_item['subtype']
                        task[1].update(task_item)
                    elif task_item['subtype'] == 'waypoint_info':
                        del task_item['subtype']
                        task[1]['waypoints'].append(task_item)

            elif record_type == 'D':
                if error:
                    if MissingRecordsError not in dgps_records[0]:
                        dgps_records[0].append(MissingRecordsError)
                else:
                    dgps_records[1].append(line)
            elif record_type == 'E':
                if error:
                    if MissingRecordsError not in event_records[0]:
                        event_records[0].append(MissingRecordsError)
                else:
                    event_records[1].append(line)
            elif record_type == 'F':
                if error:
                    if MissingRecordsError not in satellite_records[0]:
                        satellite_records[0].append(MissingRecordsError)
                else:
                    satellite_records[1].append(line)
            elif record_type == 'G':
                if error:
                    if MissingRecordsError not in security_records[0]:
                        security_records[0].append(MissingRecordsError)
                else:
                    security_records[1].append(line)
            elif record_type == 'H':
                header_item = line

                if error:
                    if MissingRecordsError not in header[0]:
                        header[0].append(MissingRecordsError)
                else:
                    del header_item['source']
                    header[1].update(header_item)
            elif record_type == 'I':
                if error:
                    fix_record_extensions[0].append(error)
                else:
                    fix_record_extensions[1] = line
            elif record_type == 'J':
                if error:
                    k_record_extensions[0].append(error)
                else:
                    k_record_extensions[1] = line
            elif record_type == 'K':
                if error:
                    if MissingRecordsError not in k_records[0]:
                        k_records[0].append(MissingRecordsError)
                else:

                    # add MissingExtensionsError when fix_record_extensions contains error
                    if len(k_record_extensions[0]) > 0 and MissingExtensionsError not in k_records[0]:
                        k_records[0].append(MissingExtensionsError)

                    k_record = LowLevelReader.process_K_record(line, k_record_extensions[1])
                    k_records[1].append(k_record)
            elif record_type == 'L':
                if error:
                    if MissingRecordsError not in comment_records[0]:
                        comment_records[0].append(MissingRecordsError)
                else:
                    comment_records[1].append(line)

        return dict(logger_id=logger_id,                            # A record
                    fix_records=fix_records,                        # B records
                    task=task,                                      # C records
                    dgps_records=dgps_records,                      # D records
                    event_records=event_records,                    # E records
                    satellite_records=satellite_records,            # F records
                    security_records=security_records,              # G records
                    header=header,                                  # H records
                    fix_record_extensions=fix_record_extensions,    # I records
                    k_record_extensions=k_record_extensions,        # J records
                    k_records=k_records,                            # K records
                    comment_records=comment_records,                # L records
                    )