Lines Matching defs:fp
113 * if success returns array(fp, array(changeloglines), $head, $tail, $eof)
114 * where fp only defined for chuck reading, needs closing.
125 $fp = null;
138 $fp = fopen($file, 'rb'); // "file pointer"
139 if ($fp === false) {
142 fseek($fp, 0, SEEK_END);
143 $eof = ftell($fp);
149 $finger = $this->getNewlinepointer($fp, $finger);
150 $tmp = fgets($fp);
166 fclose($fp);
170 $lines = $this->readChunk($fp, $head, $tail);
172 return [$fp, $lines, $head, $tail, $eof];
179 * @param resource $fp resource file pointer
184 protected function readChunk($fp, $head, $tail)
189 fseek($fp, $head);
190 while ($got < $chunk_size && !feof($fp)) {
191 $tmp = @fread($fp, max(min($this->chunk_size, $chunk_size - $got), 0));
206 * @param resource $fp file pointer
210 protected function getNewlinepointer($fp, $finger)
212 fseek($fp, $finger);
215 fgets($fp); // slip the finger forward to a new line
216 $nl = ftell($fp);
224 * @param resource $fp file pointer
233 protected function readAdjacentChunk($fp, $head, $tail, $direction)
235 if (!$fp) return [[], $head, $tail];
241 $tail = $this->getNewlinepointer($fp, $tail);
247 $nl = $this->getNewlinepointer($fp, $head);
259 $lines = $this->readChunk($fp, $head, $tail);