private void createArchive(String folderName) throws Exception { File file = this.temporaryFolder.newFile(); TestJarCreator.createTestJar(file); this.rootFolder = StringUtils.hasText(folderName) ? this.temporaryFolder.newFolder(folderName) : this.temporaryFolder.newFolder(); JarFile jarFile = new JarFile(file); Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); File destination = new File( this.rootFolder.getAbsolutePath() + File.separator + entry.getName()); destination.getParentFile().mkdirs(); if (entry.isDirectory()) { destination.mkdir(); } else { copy(jarFile.getInputStream(entry), new FileOutputStream(destination)); } } this.archive = new ExplodedArchive(this.rootFolder); jarFile.close(); }
@Before public void setup() throws Exception { File file = this.temporaryFolder.newFile(); TestJarCreator.createTestJar(file); this.rootFolder = this.temporaryFolder.newFolder(); JarFile jarFile = new JarFile(file); Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); File destination = new File( this.rootFolder.getAbsolutePath() + File.separator + entry.getName()); destination.getParentFile().mkdirs(); if (entry.isDirectory()) { destination.mkdir(); } else { copy(jarFile.getInputStream(entry), new FileOutputStream(destination)); } } this.archive = new ExplodedArchive(this.rootFolder); jarFile.close(); }
@Before public void setup() throws Exception { this.rootJarFile = this.temporaryFolder.newFile(); TestJarCreator.createTestJar(this.rootJarFile); this.jarFile = new JarFile(this.rootJarFile); }
@Before public void setup() throws Exception { this.jarFile = this.temporaryFolder.newFile(); TestJarCreator.createTestJar(this.jarFile); this.jarData = new RandomAccessDataFile(this.jarFile); }
private void setup(boolean unpackNested) throws Exception { this.rootJarFile = this.temporaryFolder.newFile(); this.rootJarFileUrl = this.rootJarFile.toURI().toString(); TestJarCreator.createTestJar(this.rootJarFile, unpackNested); this.archive = new JarFileArchive(this.rootJarFile); }