RunJar { @Deprecated public static void unJarAndSave(InputStream inputStream, File toDir, String name, Pattern unpackRegex) throws IOException{ File file = new File(toDir, name); ensureDirectory(toDir); try (OutputStream jar = new FileOutputStream(file); TeeInputStream teeInputStream = new TeeInputStream(inputStream, jar)) { unJar(teeInputStream, toDir, unpackRegex); } }  void unJar(File jarFile, File toDir); static void unJar(InputStream inputStream, File toDir,
                           Pattern unpackRegex); @Deprecated static void unJarAndSave(InputStream inputStream, File toDir,
                           String name, Pattern unpackRegex); static void unJar(File jarFile, File toDir, Pattern unpackRegex); static void main(String[] args); void run(String[] args); static final Pattern MATCH_ANY; static final int SHUTDOWN_HOOK_PRIORITY; static final String HADOOP_USE_CLIENT_CLASSLOADER; static final String HADOOP_CLASSPATH; static final String HADOOP_CLIENT_CLASSLOADER_SYSTEM_CLASSES; static final String HADOOP_CLIENT_SKIP_UNJAR; }
@SuppressWarnings("deprecation") @Test public void testBigJar() throws Exception { Random r = new Random(System.currentTimeMillis()); File dir = new File(TEST_ROOT_DIR, Long.toHexString(r.nextLong())); Assert.assertTrue(dir.mkdirs()); File input = generateBigJar(dir); File output = new File(dir, "job2.jar"); try { try (InputStream is = new FileInputStream(input)) { RunJar.unJarAndSave(is, dir, "job2.jar", Pattern.compile(".*")); } Assert.assertEquals(input.length(), output.length()); for (int i = 0; i < 10; ++i) { File subdir = new File(dir, ((i % 2 == 0) ? "dir/" : "")); File f = new File(subdir, "f" + Integer.toString(i)); Assert.assertEquals(756, f.length()); } } finally { FileSystem fs = LocalFileSystem.getLocal(new Configuration()); fs.delete(new Path(dir.getAbsolutePath()), true); } }