Returns the scheme of a URI (e.g. a stream).
$uri: A stream, referenced as "scheme://target".
A string containing the name of the scheme, or FALSE if none. For example, the URI "public://example.txt" would return "public".
function file_uri_scheme($uri) {
$position = strpos($uri, '://');
return $position ? substr($uri, 0, $position) : FALSE;
}