private URI decodeHarURI ( URI rawURI , Configuration conf ) throws IOException { String tmpAuth = rawURI . getAuthority ( ) ; //we are using the default file //system in the config //so create a underlying uri and //return it if ( tmpAuth == null ) { //create a path return FileSystem . getDefaultUri ( conf ) ; } String host = rawURI . getHost ( ) ; String [ ] str = host . split ( "-" , 2 ) ; if ( str [ 0 ] == null ) { throw new IOException ( "URI: " + rawURI + " is an invalid Har URI." ) ; } String underLyingScheme = str [ 0 ] ; String underLyingHost = ( str . length > 1 ) ? str [ 1 ] : null ; int underLyingPort = rawURI . getPort ( ) ; String auth = ( underLyingHost == null && underLyingPort == - 1 ) ? null : ( underLyingHost + ":" + underLyingPort ) ; URI tmp = null ; if ( rawURI . getQuery ( ) != null ) { // query component not allowed throw new IOException ( "query component in Path not supported " + rawURI ) ; } try { tmp = new URI ( underLyingScheme , auth , rawURI . getPath ( ) , rawURI . getQuery ( ) , rawURI . getFragment ( ) ) ; } catch ( URISyntaxException e ) { // do nothing should not happen } return tmp ; }
decode the raw URI to get the underlying URI