Skip forward in the open file pointer

This is basically a wrapper around seek() (and a workaround for bzip2)

@param int $bytes seek to this position
7535
protected function skipbytes($bytes)
    {
        if ($this->comptype === Archive::COMPRESS_GZIP) {
            @gzseek($this->fh, $bytes, SEEK_CUR);
        } elseif ($this->comptype === Archive::COMPRESS_BZIP) {
            // there is no seek in bzip2, we simply read on
            // bzread allows to read a max of 8kb at once
            while($bytes) {
                $toread = min(8192, $bytes);
                @bzread($this->fh, $toread);
                $bytes -= $toread;
            }
        } else {
            @fseek($this->fh, $bytes, SEEK_CUR);
        }
    }
856536
public function writeLine(string $bytes): int
    {
        return $this->outputStream->writeLine(iconv('UTF-8', $this->charset, $bytes));
    }
578434
private static function decodeDouble($length, &$bytes)
    {
        // Not enough bytes
        if ($length > count($bytes))
        {
            throw new CborException("The supplied byte string is too short to decode the specified double type.");
        }

        // Grab the required number of bytes
        $byteArray = array_splice($bytes, 0, $length);

        // Unpack a 32 bit double
        if ($length == 4)
        {
            return Float32::decode($byteArray);
        }

        // Unpack a 64 bit double
        else if ($length == 8)
        {
            return Float64::decode($byteArray);
        }

        // Unpack a 16 bit double
        else
        {
            return Float16::decode($byteArray);
        }
    }
792875
public function setHeadersLimit($bytes) {
		if($bytes < static::PHP_HEADERS_SIZE) {
			throw new \Exception('Headers limit cannot be less then ' . __CLASS__ . '::PHP_HEADERS_SIZE');
		}
		$bytes -= static::PHP_HEADERS_SIZE;
		$this->headersLimit = $bytes < static::CLIENT_HEADERS_LIMIT ? $bytes : static::CLIENT_HEADERS_LIMIT;
	}
917959
public function isAnimated($bytes){

        $bytes->setPosition(13);
        $lastPos = $bytes->getPosition();
        $gceCount = 0;
        while (($lastPos = $bytes->find('21f904', $lastPos))!== false) {
            $gceCount++;
            if($gceCount>1){
                return true;
            }
        }
        return false;
    }
933918
public static function byteStringToInt($bytes)
    {
        if (!self::isSupported()) {
            throw new \RuntimeException('This utility is only supported on 64 bit machines with PHP version > 5.5.');
        }
        if (self::isSystemLittleEndian()) {
            $bytes = strrev($bytes);
        }
        return unpack("q", $bytes)[1];
    }
451051
static function bytes($bytes = Constants::BYTES)
    {
        # Test the length for validity.
        Helpers::rangeCheck($bytes, Constants::BYTES_MAX, Constants::BYTES_MIN, 'Entropy', 'bytes');

        return \Sodium\randombytes_buf($bytes);
    }
39305
public function read($bytes = 2082)
    {
        return feof($this->stream) ? false : fread($this->stream, $bytes);
    }
886413
private function writeEncoded($bytes)
    {
        $encoded = preg_replace('/\r\n|\r|\n/', "\r\n", rtrim(convert_uuencode($bytes)));
        // removes ending '`' line
        $this->stream->write("\r\n" . rtrim(substr($encoded, 0, -1)));
    }
283244
public function shift($bytes)
    {
        $bufferLen = strlen($this->buffer);

        if ($bytes === $bufferLen) {
            $return       = $this->buffer;
            $this->buffer = '';
        } else {
            $return       = substr($this->buffer, 0, $bytes);
            $this->buffer = substr($this->buffer, $bytes);
        }

        return $return;
    }
195407
private function read($bytes)
    {
        $read = '';
        $total = $bytes;

        while (!feof($this->handle) && $bytes) {
            if (false === ($chunk = fread($this->handle, $bytes))) {
                throw new RuntimeException(
                    sprintf(
                        'Could not read %d bytes from "%s".',
                        $bytes,
                        $this->file
                    )
                );
            }

            $read .= $chunk;
            $bytes -= strlen($chunk);
        }

        if (($actual = strlen($read)) !== $total) {
            throw new RuntimeException(
                sprintf(
                    'Only read %d of %d in "%s".',
                    $actual,
                    $total,
                    $this->file
                )
            );
        }

        return $read;
    }
201059
public function stream_seek($offset, $whence = SEEK_SET) {
		if ($whence == SEEK_SET) $this->pos = $offset;
		elseif ($whence == SEEK_CUR) $this->pos += $offset;
		elseif ($whence == SEEK_END) $this->pos = strlen($this->entry['data']) - $offset;
		else {
			return false;
		}
		return true;
	}
946643
def skip(self, num_bytes):
        """"""
        if num_bytes is None:
            self._offset = len(self._data)
        else:
            self._offset += num_bytes
307468
protected synchronized void skipForward(int eventsToSkip)
			throws IOException {
		int offset = 0;
		for (int i = 0; i < eventsToSkip; i++) {
			// adjust position for reading offset
			storage.seek(position);
			// read forward skip offset
			offset = storage.readInt();
			// set file pointer to next event position
			position += offset;
			// adjust index
			index++;
		}
	}
1147723
protected function formatBytes($bytes)
    {
        $bytes = (int) $bytes;

        if ($bytes > 1024 * 1024) {
            return round($bytes / 1024 / 1024, 2) . ' MB';
        }

        if ($bytes > 1024) {
            return round($bytes / 1024, 2) . ' KB';
        }

        return $bytes . ' B';
    }
58661
public function seek($offset)
    {
        if ($offset < 0 || $offset > $this->file->length) {
            throw new InvalidArgumentException(sprintf('$offset must be >= 0 and <= %d; given: %d', $this->file->length, $offset));
        }

        /* Compute the offsets for the chunk and buffer (i.e. chunk data) from
         * which we will expect to read after seeking. If the chunk offset
         * changed, we'll also need to reset the buffer.
         */
        $lastChunkOffset = $this->chunkOffset;
        $this->chunkOffset = (integer) floor($offset / $this->chunkSize);
        $this->bufferOffset = $offset % $this->chunkSize;

        if ($lastChunkOffset === $this->chunkOffset) {
            return;
        }

        if ($this->chunksIterator === null) {
            return;
        }

        // Clear the buffer since the current chunk will be changed
        $this->buffer = null;

        /* If we are seeking to a previous chunk, we need to reinitialize the
         * chunk iterator.
         */
        if ($lastChunkOffset > $this->chunkOffset) {
            $this->chunksIterator = null;
            return;
        }

        /* If we are seeking to a subsequent chunk, we do not need to
         * reinitalize the chunk iterator. Instead, we can simply move forward
         * to $this->chunkOffset.
         */
        $numChunks = $this->chunkOffset - $lastChunkOffset;
        for ($i = 0; $i < $numChunks; $i++) {
            $this->chunksIterator->next();
        }
    }
1215759
protected void advancePosition(int bytes)
  {
    if (tc.isEntryEnabled()) Tr.entry(tc, "advancePosition", new Object[] {this, new Integer(bytes)});
    
    final int newPosition = _buffer.position() + bytes;      
    _buffer.position(newPosition);
    
    if (tc.isDebugEnabled()) Tr.debug(tc, "Buffer's position now " + newPosition);
    
    if (tc.isEntryEnabled()) Tr.exit(tc, "advancePosition");
  }