Lines Matching refs:fp
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);
171 fclose($fp);
175 $lines = $this->readChunk($fp, $head, $tail);
177 return [$fp, $lines, $head, $tail, $eof];
184 * @param resource $fp resource file pointer
189 protected function readChunk($fp, $head, $tail) argument
194 fseek($fp, $head);
195 while ($got < $chunk_size && !feof($fp)) {
196 $tmp = @fread($fp, max(min($this->chunk_size, $chunk_size - $got), 0));
211 * @param resource $fp file pointer
215 protected function getNewlinepointer($fp, $finger) argument
217 fseek($fp, $finger);
220 fgets($fp); // slip the finger forward to a new line
221 $nl = ftell($fp);
229 * @param resource $fp file pointer
238 protected function readAdjacentChunk($fp, $head, $tail, $direction) argument
240 if (!$fp) return [[], $head, $tail];
246 $tail = $this->getNewlinepointer($fp, $tail);
252 $nl = $this->getNewlinepointer($fp, $head);
264 $lines = $this->readChunk($fp, $head, $tail);