question: public static String reverseUrl ( URL url ) { String host = url . getHost ( ) ; String file = url . getFile ( ) ; String protocol = url . getProtocol ( ) ; int port = url . getPort ( ) ; StringBuilder buf = new StringBuilder ( ) ; reverseAppendSplits ( host , buf ) ; buf . append ( ':' ) ; buf . append ( protocol ) ; if ( port != - 1 ) { buf . append ( ':' ) ; buf . append ( port ) ; } if ( file . length ( ) > 0 && '/' != file . charAt ( 0 ) ) { buf . append ( '/' ) ; } buf . append ( file ) ; return buf . toString ( ) ; }
target:  Reverses a url's domain. This form is better for storing in hbase. Because scans within the same domain are faster. <p> E.g. "http://bar.foo.com:8983/to/index.html?a=b" becomes "com.foo.bar:http:8983/to/index.html?a=b".