public void testRoundTrip_1(String resource) throws Exception { long start1 = System.currentTimeMillis(); String originalFile = this.getClass().getProtectionDomain().getCodeSource().getLocation().getFile() + resource; long start2 = System.currentTimeMillis(); IsoFile isoFile = new IsoFile(originalFile); long start3 = System.currentTimeMillis(); long start4 = System.currentTimeMillis(); Walk.through(isoFile); long start5 = System.currentTimeMillis(); File result = File.createTempFile(this.getName(), resource.replace("/", "_")); FileOutputStream fos = new FileOutputStream(result); FileChannel fcOut = fos.getChannel(); isoFile.getBox(fcOut); fcOut.close(); fos.close(); long start6 = System.currentTimeMillis(); /* System.err.println("Preparing tmp copy took: " + (start2 - start1) + "ms"); System.err.println("Parsing took : " + (start3 - start2) + "ms"); System.err.println("Writing took : " + (start6 - start3) + "ms"); System.err.println("Walking took : " + (start5 - start4) + "ms");*/ IsoFile copyViaIsoFileReparsed = new IsoFile(result.getAbsolutePath()); BoxComparator.check( isoFile, copyViaIsoFileReparsed, "/moov[0]/mvhd[0]", "/moov[0]/trak[0]/tkhd[0]", "/moov[0]/trak[0]/mdia[0]/mdhd[0]"); isoFile.close(); copyViaIsoFileReparsed.close(); result.deleteOnExit(); // as windows cannot delete file when something is memory mapped and the garbage collector // doesn't necessarily free the Buffers quickly enough we cannot delete the file here (we could // but only for linux) }