@Test public void testVFSFormatting() throws Exception { String uri = FileManipulator.format( "http: assertEquals( "tgz:http: }
public static String format( String url ) { String formattedUrl = url.trim(); if ( formattedUrl.endsWith( JAR_EXTENSION ) && !formattedUrl.startsWith( JAR_PROTOCOL ) ) { return JAR_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( ZIP_EXTENSION ) && !formattedUrl.startsWith( ZIP_PROTOCOL ) ) { return ZIP_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TGZ_EXTENSION ) && !formattedUrl.startsWith( TGZ_PROTOCOL ) ) { return TGZ_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TARGZ_EXTENSION ) && !formattedUrl.startsWith( TARGZ_PROTOCOL ) ) { return TARGZ_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TBZ2_EXTENSION ) && !formattedUrl.startsWith( TBZ2_PROTOCOL ) ) { return TBZ2_PROTOCOL + formattedUrl; } return formattedUrl; }
FileManipulator { public static String format( String url ) { String formattedUrl = url.trim(); if ( formattedUrl.endsWith( JAR_EXTENSION ) && !formattedUrl.startsWith( JAR_PROTOCOL ) ) { return JAR_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( ZIP_EXTENSION ) && !formattedUrl.startsWith( ZIP_PROTOCOL ) ) { return ZIP_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TGZ_EXTENSION ) && !formattedUrl.startsWith( TGZ_PROTOCOL ) ) { return TGZ_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TARGZ_EXTENSION ) && !formattedUrl.startsWith( TARGZ_PROTOCOL ) ) { return TARGZ_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TBZ2_EXTENSION ) && !formattedUrl.startsWith( TBZ2_PROTOCOL ) ) { return TBZ2_PROTOCOL + formattedUrl; } return formattedUrl; } }
FileManipulator { public static String format( String url ) { String formattedUrl = url.trim(); if ( formattedUrl.endsWith( JAR_EXTENSION ) && !formattedUrl.startsWith( JAR_PROTOCOL ) ) { return JAR_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( ZIP_EXTENSION ) && !formattedUrl.startsWith( ZIP_PROTOCOL ) ) { return ZIP_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TGZ_EXTENSION ) && !formattedUrl.startsWith( TGZ_PROTOCOL ) ) { return TGZ_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TARGZ_EXTENSION ) && !formattedUrl.startsWith( TARGZ_PROTOCOL ) ) { return TARGZ_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TBZ2_EXTENSION ) && !formattedUrl.startsWith( TBZ2_PROTOCOL ) ) { return TBZ2_PROTOCOL + formattedUrl; } return formattedUrl; } FileManipulator(); }
FileManipulator { public static String format( String url ) { String formattedUrl = url.trim(); if ( formattedUrl.endsWith( JAR_EXTENSION ) && !formattedUrl.startsWith( JAR_PROTOCOL ) ) { return JAR_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( ZIP_EXTENSION ) && !formattedUrl.startsWith( ZIP_PROTOCOL ) ) { return ZIP_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TGZ_EXTENSION ) && !formattedUrl.startsWith( TGZ_PROTOCOL ) ) { return TGZ_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TARGZ_EXTENSION ) && !formattedUrl.startsWith( TARGZ_PROTOCOL ) ) { return TARGZ_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TBZ2_EXTENSION ) && !formattedUrl.startsWith( TBZ2_PROTOCOL ) ) { return TBZ2_PROTOCOL + formattedUrl; } return formattedUrl; } FileManipulator(); void close(); static String getBaseDir(); FileObject resolveFile( String vfsPath ); boolean exists( String vfsPath ); boolean contentEquals( String src, String dest ); boolean checksumEquals( String src, String dest ); void copy( String src, String dest ); boolean isFolder( String vfsPath ); FileObject[] browse( String vfsPath ); InputStream read( String vfsPath ); OutputStream write( String vfsPath ); static String createEnvironmentCacheDir( Environment environment ); static String createJEEApplicationCacheDir( Environment environment, JEEApplication jeeApplication ); static String createSoftwareCacheDir( Environment environment, Software software ); void createDirectory( String path ); static boolean protocolExists( String path ); static String format( String url ); void delete( String path ); static void searchAndReplace( String path, String regex, String substitute ); }
FileManipulator { public static String format( String url ) { String formattedUrl = url.trim(); if ( formattedUrl.endsWith( JAR_EXTENSION ) && !formattedUrl.startsWith( JAR_PROTOCOL ) ) { return JAR_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( ZIP_EXTENSION ) && !formattedUrl.startsWith( ZIP_PROTOCOL ) ) { return ZIP_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TGZ_EXTENSION ) && !formattedUrl.startsWith( TGZ_PROTOCOL ) ) { return TGZ_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TARGZ_EXTENSION ) && !formattedUrl.startsWith( TARGZ_PROTOCOL ) ) { return TARGZ_PROTOCOL + formattedUrl; } if ( formattedUrl.endsWith( TBZ2_EXTENSION ) && !formattedUrl.startsWith( TBZ2_PROTOCOL ) ) { return TBZ2_PROTOCOL + formattedUrl; } return formattedUrl; } FileManipulator(); void close(); static String getBaseDir(); FileObject resolveFile( String vfsPath ); boolean exists( String vfsPath ); boolean contentEquals( String src, String dest ); boolean checksumEquals( String src, String dest ); void copy( String src, String dest ); boolean isFolder( String vfsPath ); FileObject[] browse( String vfsPath ); InputStream read( String vfsPath ); OutputStream write( String vfsPath ); static String createEnvironmentCacheDir( Environment environment ); static String createJEEApplicationCacheDir( Environment environment, JEEApplication jeeApplication ); static String createSoftwareCacheDir( Environment environment, Software software ); void createDirectory( String path ); static boolean protocolExists( String path ); static String format( String url ); void delete( String path ); static void searchAndReplace( String path, String regex, String substitute );  }