@ Override public PathImpl schemeWalk ( String userPath , Map < String , Object > newAttributes , String uri , int offset ) { int length = uri . length ( ) ; if ( length < 2 + offset || uri . charAt ( offset ) != ' ' || uri . charAt ( 1 + offset ) != ' ' ) throw new RuntimeException ( "bad scheme" ) ; CharBuffer buf = new CharBuffer ( ) ; int i = 2 + offset ; int ch = 0 ; boolean isIpv6 = false ; for ( ; ( i < length && ( ch = uri . charAt ( i ) ) != ' ' && ch != ' ' && ! ( ch == ' ' && ! isIpv6 ) ) ; i ++ ) { if ( ch == ' ' ) isIpv6 = true ; else if ( ch == ' ' ) isIpv6 = false ; buf . append ( ( char ) ch ) ; } String host = buf . toString ( ) ; if ( host . length ( ) == 0 ) throw new RuntimeException ( "bad host" ) ; int port = 0 ; if ( ch == ' ' ) { for ( i ++ ; i < length && ( ch = uri . charAt ( i ) ) >= ' ' && ch <= ' ' ; i ++ ) { port = 10 * port + uri . charAt ( i ) - ' ' ; } } return create ( this , userPath , newAttributes , host , port ) ; }
Lookup the new path assuming we re the scheme root .