private void parseScheme ( byte [ ] data ) { // we know the first character is correct, find the colon for ( int i = 1 ; i < data . length ; i ++ ) { if ( ' ' == data [ i ] ) { SchemeValues val = SchemeValues . match ( data , 0 , i ) ; if ( null == val ) { throw new IllegalArgumentException ( "Invalid scheme inside URL: " + GenericUtils . getEnglishString ( data ) ) ; } setScheme ( val ) ; // scheme should be followed by "://" if ( ( i + 2 ) >= data . length || ( ' ' != data [ i + 1 ] || ' ' != data [ i + 2 ] ) ) { throw new IllegalArgumentException ( "Invalid net_path: " + GenericUtils . getEnglishString ( data ) ) ; } parseAuthority ( data , i + 3 ) ; return ; } } // no colon found throw new IllegalArgumentException ( "Invalid scheme in URL: " + GenericUtils . getEnglishString ( data ) ) ; }
Parse the scheme marker out of the input data and then start the parse for the next section . If any errors are encountered then an exception is thrown .