protected String scanScheme ( String uri ) { int i = 0 ; if ( uri == null ) return null ; int length = uri . length ( ) ; if ( length == 0 ) return null ; int ch = uri . charAt ( 0 ) ; if ( ch >= ' ' && ch <= ' ' || ch >= ' ' && ch <= ' ' ) { for ( i = 1 ; i < length ; i ++ ) { ch = uri . charAt ( i ) ; if ( ch == ' ' ) return uri . substring ( 0 , i ) . toLowerCase ( Locale . ENGLISH ) ; if ( ! ( ch >= ' ' && ch <= ' ' || ch >= ' ' && ch <= ' ' || ch >= ' ' && ch <= ' ' || ch == ' ' || ch == ' ' || ch == ' ' ) ) break ; } } return null ; }
Returns the scheme portion of a uri . Since schemes are case - insensitive normalize them to lower case .