public function detect()
    {
        $str = file_get_contents($this->uri);

        foreach ($this->getBom('all') as $encoding => $bom) {
            if (0 === strncmp($str, $bom, strlen($bom))) {
                return $encoding;
            }
        }
    }