src/Parser.php
public function parse($input, $itemCallback, $assoc = true)
    {
        $this->checkCallback($itemCallback);

        $stream = $this->openStream($input);

        try {
            $listener = new Listener($itemCallback, $assoc);
            $this->parser = new \JsonStreamingParser\Parser(
                $stream,
                $listener,
                $this->getOption('line_ending'),
                $this->getOption('emit_whitespace')
            );
            $this->parser->parse();
        } catch (\Exception $e) {
            $this->gzipSupported ? gzclose($stream) : fclose($stream);
            throw $e;
        }

        $this->gzipSupported ? gzclose($stream) : fclose($stream);
    }
public function parse($input, $itemCallback, $assoc = true)
    {
        $this->checkCallback($itemCallback);

        $stream = $this->openStream($input);

        try {
            $listener = new Listener($itemCallback, $assoc);
            $this->parser = new \JsonStreamingParser\Parser(
                $stream,
                $listener,
                $this->getOption('line_ending'),
                $this->getOption('emit_whitespace')
            );
            $this->parser->parse();
        } catch (\Exception $e) {
            $this->gzipSupported ? gzclose($stream) : fclose($stream);
            throw $e;
        }

        $this->gzipSupported ? gzclose($stream) : fclose($stream);
    }
@param string|resource $input File path or resource
@param callback|callable $itemCallback Callback
@param bool $assoc Parse as associative arrays

@throws \Exception