public static URL createUrl ( final URL baseUrl , final String path , final String filename ) { checkNotNull ( "baseUrl" , baseUrl ) ; checkNotNull ( "filename" , filename ) ; try { String baseUrlStr = baseUrl . toString ( ) ; if ( ! baseUrlStr . endsWith ( SLASH ) ) { baseUrlStr = baseUrlStr + SLASH ; } final String pathStr ; if ( ( path == null ) || ( path . length ( ) == 0 ) ) { pathStr = "" ; } else { if ( path . endsWith ( SLASH ) ) { pathStr = path ; } else { pathStr = path + SLASH ; } } return new URL ( baseUrlStr + pathStr + filename ) ; } catch ( final IOException ex ) { throw new RuntimeException ( ex ) ; } }
Creates an URL based on a directory a relative path and a filename .