public File getLocalFile ( URL remoteUri ) { StringBuilder sb = new StringBuilder ( ) ; String host = remoteUri . getHost ( ) ; String query = remoteUri . getQuery ( ) ; String path = remoteUri . getPath ( ) ; if ( host != null ) { sb . append ( host ) ; } if ( path != null ) { sb . append ( path ) ; } if ( query != null ) { sb . append ( ' ' ) ; sb . append ( query ) ; } String name ; final int maxLen = 250 ; if ( sb . length ( ) < maxLen ) { name = sb . toString ( ) ; } else { name = sb . substring ( 0 , maxLen ) ; } name = name . replace ( ' ' , ' ' ) ; name = name . replace ( ' ' , ' ' ) ; name = name . replace ( ' ' , ' ' ) ; name = name . replace ( ' ' , ' ' ) ; name = name . replace ( ' ' , ' ' ) ; name = name . replace ( ' ' , ' ' ) ; File f = new File ( cacheDir , name ) ; return f ; }
Returns the local File corresponding to the given remote URI .