protected function openFile($filename)
    {
        $this->filename = $filename;

        if (!is_file($this->filename)) {
            throw new \Exception(
                sprintf(
                    'File %s does not exist',
                    $this->filename
                )
            );
        }

        $this->file = fopen($this->filename, 'rb');
        if (false === $this->file) {
            throw new \Exception(
                sprintf(
                    'Could not open file %s for reading',
                    $this->filename
                )
            );
        }
    }