Back to Stream class

Method eof

public bool
eof
()
Work out if we're at the end of the file for a stream
Returns
  • bool
Since
  • 1.7.0
Class: Stream
Project: Joomla

Method eof - Source code

/**
 * Work out if we're at the end of the file for a stream
 *
 * @return  boolean
 *
 * @since   1.7.0
 */
public function eof()
{
    if (!$this->fh) {
        $this->setError(Text::_('JLIB_FILESYSTEM_ERROR_STREAMS_FILE_NOT_OPEN'));
        return false;
    }
    // Capture PHP errors
    $php_errormsg = '';
    $track_errors = ini_get('track_errors');
    ini_set('track_errors', true);
    switch ($this->processingmethod) {
        case 'gz':
            $res = gzeof($this->fh);
            break;
        case 'bz':
        case 'f':
        default:
            $res = feof($this->fh);
            break;
    }
    if ($php_errormsg) {
        $this->setError($php_errormsg);
    }
    // Restore error tracking to what it was before
    ini_set('track_errors', $track_errors);
    // Return the result
    return $res;
}