public static void writeTo(File file, InputStream in) throws IOException { writeTo(file, in, BUFFER_SIZE); }
public static void writeTo(OutputStream outputStream, InputStream in, boolean close) throws IOException { writeTo(outputStream, in, BUFFER_SIZE, close); }
public static void writeTo(File file, InputStream in, int bufferSize) throws IOException { writeTo(new FileOutputStream(file), in, bufferSize, true); }
public PomDetails findPomFile(File jar) throws IOException { JarFile jarFile = new JarFile(jar); File file = null; Properties properties = null; Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); String name = entry.getName(); if (name.matches("META-INF/maven/.*/.*/pom.xml")) { InputStream in = jarFile.getInputStream(entry); // lets create a temporary file file = File.createTempFile("fabric-pomegranate-", ".pom.xml"); IOHelpers.writeTo(file, in); } else if (name.matches("META-INF/maven/.*/.*/pom.properties")) { InputStream in = jarFile.getInputStream(entry); properties = new Properties(); properties.load(in); } if (file != null && properties != null) { break; } } return new PomDetails(file, properties); }
public PomDetails findPomFile(File jar) throws IOException { JarFile jarFile = new JarFile(jar); File file = null; Properties properties = null; Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); String name = entry.getName(); if (name.matches("META-INF/maven/.*/.*/pom.xml")) { InputStream in = jarFile.getInputStream(entry); // lets create a temporary file file = File.createTempFile("fabric-pomegranate-", ".pom.xml"); IOHelpers.writeTo(file, in); } else if (name.matches("META-INF/maven/.*/.*/pom.properties")) { InputStream in = jarFile.getInputStream(entry); properties = new Properties(); properties.load(in); } if (file != null && properties != null) { break; } } return new PomDetails(file, properties); }
IOHelpers.writeTo(file, in);
IOHelpers.writeTo(out, jarFile.getInputStream(jarEntry), false);
IOHelpers.writeTo(out, jarFile.getInputStream(jarEntry), false);