Lines Matching refs:length
76 * The buffer length.
83 * The total length of the stream.
141 * Returns the byte length of the buffer.
246 * @param int $length
250 public function readBytes($length, $position = null)
252 $length = (int) $length;
256 $this->reset($position, $length);
265 if (($offset + $length) > $this->bufferLength &&
266 ((!$this->increaseLength($length)) || ($offset + $length) > $this->bufferLength)
271 $bytes = \substr($this->buffer, $offset, $length);
272 $this->offset = $offset + $length;
280 * @param int $length
283 public function readLine($length = 1024)
306 if (\strlen($line) >= $length) {
323 \sprintf('Offset (%s) out of range (length: %s)', $offset, $this->bufferLength)
376 * Gets the total available length.
391 * Resets the buffer to a position and re-read the buffer with the given length.
400 * @param int $length Length of the new buffer. Mustn't be negative
402 public function reset($pos = 0, $length = 200)
413 $this->buffer = $length > 0 ? \fread($this->stream, $length) : '';
418 // length values > 8096 will be ignored, so use the
420 if ($this->bufferLength < $length && $this->increaseLength($length - $this->bufferLength)) {
422 $this->buffer = \substr($this->buffer, 0, $length);
428 * Ensures bytes in the buffer with a specific length and location in the file.
431 * @param int $length
434 public function ensure($pos, $length)
438 && ($this->position + $this->bufferLength) >= ($pos + $length)
442 $this->reset($pos, $length);
454 $length = \max($minLength, 100);
460 $newLength = $this->bufferLength + $length;