Parse length-encoded string
@return integer Result
8538
public function parseEncodedString()
    {
        $l = $this->parseEncodedBinary();
        if (($l === null) || ($l === false)) {
            return $l;
        }
        return $this->read($l);
    }
777248
public function getLiteralLength()
    {
        if ($this->_stream->substring(-1, 1) === '}') {
            $literal_data = $this->_stream->getString(
                $this->_stream->search('{', true) - 1
            );
            $literal_len = substr($literal_data, 2, -1);

            if (is_numeric($literal_len)) {
                return array(
                    'binary' => ($literal_data[0] === '~'),
                    'length' => intval($literal_len)
                );
            }
        }

        return null;
    }
402988
public function readShortstr()
    {
        $this->_bitcount = $this->_bits = 0;
        list(, $slen) = unpack('C', $this->_rawread(1));
        return $this->_rawread($slen);
    }
1025942
public function read($length)
    {
        $index = 0;
        $contents = '';
        while ($this->iterator->valid() && $index < $length) {
            if ($this->stringify !== null) {
                $contents .= $this->stringify->call($this, $this->iterator->current());
            } else {
                $contents .= $this->iterator->current();
            }

            $this->iterator->next();
            ++$this->position;
            ++$index;
        }

        return $contents;
    }
303318
public function getMaxLength()
    {
        if ($this->isString() && isset($this->methodParams[0])) {
            return intval($this->methodParams[0]);
        }

        return null;
    }
566185
public static function len(string $string): int
    {
        if (false === $encoding = \mb_detect_encoding($string, null, true)) {
            return \strlen($string);
        }

        return \mb_strwidth($string, $encoding);
    }
1322873
public function parseDouble()
    {
        try {
            if (Endianness::LITTLE()) {
                return \unpack('d', \strrev(mb_orig_substr($this->buffer, 0, 8)))[1];
            }
            return \unpack('d', $this->buffer)[1]; // @codeCoverageIgnore
        } finally {
            $this->buffer = mb_orig_substr($this->buffer, 8);
        }
    }
41628
public function readLongstr()
    {
        $this->_bitcount = $this->_bits = 0;
        $slen = $this->readPhpInt();
        if ($slen < 0) {
            throw new \Exception("Strings longer than supported on this platform");
        }
        return $this->_rawread($slen);
    }
757044
private int parseByte()
        throws IOException
    {
        while (_chunkLength <= 0) {
            if (_isLastChunk) {
                return -1;
            }

            int code = read();

            switch (code) {
                case 'b':
                    _isLastChunk = false;

                    _chunkLength = (read() << 8) + read();
                    break;

                case 'B':
                    _isLastChunk = true;

                    _chunkLength = (read() << 8) + read();
                    break;

                default:
                    throw expect("byte[]", code);
            }
        }

        _chunkLength--;

        return read();
    }
118037
public function readInt16Signed()
    {

        // Read the data into a string
        $string = $this->read(2);

        // For big endian we need to reverse the bytes
        if ($this->number_type == self::NUMBER_TYPE_BIGENDIAN) {
            $string = strrev($string);
        }

        $int = unpack('sint', $string);

        unset($string);

        return $int['int'];
    }
583233
private function decodeInteger()
    {
        $offsetOfE = strpos($this->source, "e", $this->offset);
        if (false === $offsetOfE) {
            throw new RuntimeException("Unterminated integer entity at offset $this->offset");
        }

        $currentOffset = $this->offset;
        if ("-" == $this->getChar($currentOffset)) {
            ++$currentOffset;
        }

        if ($offsetOfE === $currentOffset) {
            throw new RuntimeException("Empty integer entity at offset $this->offset");
        }

        while ($currentOffset < $offsetOfE) {
            if (!ctype_digit($this->getChar($currentOffset))) {
                throw new RuntimeException("Non-numeric character found in integer entity at offset $this->offset");
            }
            ++$currentOffset;
        }

        $value = substr($this->source, $this->offset, $offsetOfE - $this->offset);

        // One last check to make sure zero-padded integers don't slip by, as
        // they're not allowed per bencode specification.
        $absoluteValue = (string) abs($value);
        if (1 < strlen($absoluteValue) && "0" == $value[0]) {
            throw new RuntimeException("Illegal zero-padding found in integer entity at offset $this->offset");
        }

        $this->offset = $offsetOfE + 1;

        // The +0 auto-casts the chunk to either an integer or a float(in cases
        // where an integer would overrun the max limits of integer types)
        return $value + 0;
    }
499514
protected function getLength()
    {
        if (!$this->length) {
            $this->length = $this->util->width();
        }

        return $this->length;
    }
578556
public function getLength() : ?float 
    {
        if ( ! $this->hasLength()) {
            $this->setLength($this->getDefaultLength());
        }
        return $this->length;
    }
1159132
public function readString() {

            $strref = $this->readU29();

            if (($strref & 0x01) == 0) {
                $strref = $strref >> 1;
                if ($strref>=count($this->storedStrings)) {
                    throw new Exception('Undefined string reference: ' . $strref);
                    return false;
                }
                return $this->storedStrings[$strref];
            } else {
                $strlen = $strref >> 1; 
                $str = $this->stream->readBuffer($strlen);
                if ($str != "") $this->storedStrings[] = $str;
                return $str;
            }

        }
1035820
public function readLong()
    {
        $this->_bitcount = $this->_bits = 0;
        list(, $res) = unpack('N', $this->_rawread(4));
        $sres = sprintf("%u", $res);
        return $sres;
    }
140426
public function parse() {

		$lines = str_getcsv($this->source, $this->newline, $this->enclosure, $this->escape);

		// add keys from headline if available
		if ($this->getSourceHasHeadline()) {
			$keys = explode($this->delimiter, $lines[0]);
			$this->addKeys($keys);
			unset($lines[0]);
		}

		foreach ($lines as $line) { // iterate over all lines
			
			$values = str_getcsv($line, $this->delimiter, $this->enclosure, $this->escape); // save values in an array
			
			
			foreach ($values as $key => $value) {
				/* remove the escape character, because PHP doesn't do it
				 * https://bugs.php.net/bug.php?id=55413
				 */
				$values[$key] = str_replace($this->escape.$this->enclosure, $this->enclosure, $value);
				// trim all values if trimming is enabled
				if ($this->trim) {
					$values[$key] = trim($values[$key]);
				}
			}
			
			$dataset = array(); // create dataset
			foreach ($values as $position => $rawValue) { // iterate over all values
				$key = isset($this->keys[$position]) ? $this->keys[$position] : $position; // use the property number or a given key as index
				
				$processedValue = $rawValue;

				if (isset($this->modifiers[$key])) { // if there are registered modifiers for that key, let them do their work
					foreach ((array)$this->modifiers[$key] as $modifier) {
						$processedValue = call_user_func($modifier, $processedValue);
					}
				}
				
				$dataset[$key] = $processedValue;
			}

			$this->result[] = $dataset; // add dataset to the final result

		}
		return $this->result;
	}
219619
protected function length()
    {
        if (!isset($this->meta['length'])) {
            $this->meta['length'] = strlen($this->raw_data);
        }

        return $this->meta['length'];
    }