Lines Matching refs:offset
14 private $offset;
23 * @param int|null $offset Position to seek to before reading (only
29 $offset = 0
33 $this->setOffset($offset);
53 return $tell >= $this->offset + $this->limit;
65 return $length - $this->offset;
67 return min($this->limit, $length - $this->offset);
75 public function seek($offset, $whence = SEEK_SET)
77 if ($whence !== SEEK_SET || $offset < 0) {
81 $offset += $this->offset;
84 if ($offset > $this->offset + $this->limit) {
85 $offset = $this->offset + $this->limit;
89 return $this->stream->seek($offset);
98 return $this->stream->tell() - $this->offset;
102 * Set the offset to start limiting from
104 * @param int $offset Offset to seek to and begin byte limiting from
109 public function setOffset($offset)
113 if ($current !== $offset) {
114 // If the stream cannot seek to the offset position, then read to it
115 if (!$this->stream->seek($offset)) {
116 if ($current > $offset) {
117 throw new SeekException($this, $offset);
119 $this->stream->read($offset - $current);
124 $this->offset = $offset;
151 // bytes + original offset
152 $remaining = ($this->offset + $this->limit) - $this->stream->tell();