question: protected static String fixURI ( String str ) { str = str . replace ( java . io . File . separatorChar , '/' ) ; StringBuffer sb = null ; if ( str . length ( ) >= 2 ) { char ch1 = str . charAt ( 1 ) ; if ( ch1 == ':' ) { char ch0 = Character . toUpperCase ( str . charAt ( 0 ) ) ; if ( ch0 >= 'A' && ch0 <= 'Z' ) { sb = new StringBuffer ( str . length ( ) + 8 ) ; sb . append ( "file:///" ) ; } } else if ( ch1 == '/' && str . charAt ( 0 ) == '/' ) { sb = new StringBuffer ( str . length ( ) + 5 ) ; sb . append ( "file:" ) ; } } int pos = str . indexOf ( ' ' ) ; if ( pos < 0 ) { if ( sb != null ) { sb . append ( str ) ; str = sb . toString ( ) ; } } else { if ( sb == null ) sb = new StringBuffer ( str . length ( ) ) ; for ( int i = 0 ; i < pos ; i ++ ) sb . append ( str . charAt ( i ) ) ; sb . append ( "%20" ) ; for ( int i = pos + 1 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == ' ' ) sb . append ( "%20" ) ; else sb . append ( str . charAt ( i ) ) ; } str = sb . toString ( ) ; } return str ; }
target:  Fixes a platform dependent filename to standard URI form.