@Test public void test_readDiffFileFromJar() throws IOException { File jar = new File("D:\\0000_test\\updiff\\abacus\\abacus-product-bootstrap-1.0.0-assembly.new.tar.gz_up_source_20150812164139\\lib\\abacus-dao-transjnl-1.0.0.jar"); File diffFile = UpdiffFileUtils.readDiffFileFromJar(jar); System.out.println(diffFile.getAbsolutePath()); }
public static File readDiffFileFromJar(File jar){ JarFile jarFile = null; try { jarFile = new JarFile(jar); String diffFileName = jar.getName().substring(0, jar.getName().length() - FileType.JAR.getType().length()) + FileType.DIFF.getType(); JarEntry entry = jarFile.getJarEntry("META-INF/" + diffFileName); if(entry == null) return null; File diffFile = new File(jar.getParent(), diffFileName); FileUtils.copyInputStreamToFile(jarFile.getInputStream(entry), diffFile); return diffFile; } catch (IOException e) { return null; } }
UpdiffFileUtils { public static File readDiffFileFromJar(File jar){ JarFile jarFile = null; try { jarFile = new JarFile(jar); String diffFileName = jar.getName().substring(0, jar.getName().length() - FileType.JAR.getType().length()) + FileType.DIFF.getType(); JarEntry entry = jarFile.getJarEntry("META-INF/" + diffFileName); if(entry == null) return null; File diffFile = new File(jar.getParent(), diffFileName); FileUtils.copyInputStreamToFile(jarFile.getInputStream(entry), diffFile); return diffFile; } catch (IOException e) { return null; } } }
UpdiffFileUtils { public static File readDiffFileFromJar(File jar){ JarFile jarFile = null; try { jarFile = new JarFile(jar); String diffFileName = jar.getName().substring(0, jar.getName().length() - FileType.JAR.getType().length()) + FileType.DIFF.getType(); JarEntry entry = jarFile.getJarEntry("META-INF/" + diffFileName); if(entry == null) return null; File diffFile = new File(jar.getParent(), diffFileName); FileUtils.copyInputStreamToFile(jarFile.getInputStream(entry), diffFile); return diffFile; } catch (IOException e) { return null; } }  }
UpdiffFileUtils { public static File readDiffFileFromJar(File jar){ JarFile jarFile = null; try { jarFile = new JarFile(jar); String diffFileName = jar.getName().substring(0, jar.getName().length() - FileType.JAR.getType().length()) + FileType.DIFF.getType(); JarEntry entry = jarFile.getJarEntry("META-INF/" + diffFileName); if(entry == null) return null; File diffFile = new File(jar.getParent(), diffFileName); FileUtils.copyInputStreamToFile(jarFile.getInputStream(entry), diffFile); return diffFile; } catch (IOException e) { return null; } }  static boolean isInnerClassFile(File file); static boolean isControlDeleteFile(File file); static File castControlFile(File file); static File readDiffFileFromJar(File jar); static Stack<File> mkdirs(File file); }
UpdiffFileUtils { public static File readDiffFileFromJar(File jar){ JarFile jarFile = null; try { jarFile = new JarFile(jar); String diffFileName = jar.getName().substring(0, jar.getName().length() - FileType.JAR.getType().length()) + FileType.DIFF.getType(); JarEntry entry = jarFile.getJarEntry("META-INF/" + diffFileName); if(entry == null) return null; File diffFile = new File(jar.getParent(), diffFileName); FileUtils.copyInputStreamToFile(jarFile.getInputStream(entry), diffFile); return diffFile; } catch (IOException e) { return null; } }  static boolean isInnerClassFile(File file); static boolean isControlDeleteFile(File file); static File castControlFile(File file); static File readDiffFileFromJar(File jar); static Stack<File> mkdirs(File file);  }