public function getEncoding($direction)
    {
        if (!isset($this->encoding[$direction])) {
            throw new Exception("Encoding direction invalid");
        }

        return $this->encoding[$direction];
    }