public function setEncoding($encoding)
    {
        if (empty($encoding))
            throw new \InvalidArgumentException('The encoding may not be empty or NULL.');
        if (!is_string($encoding))
            throw new \InvalidArgumentException('The encoding must be a string.');

        $this->encoding = $encoding;

        return $this;
    }