Search in sources :

Example 6 with Main

use of sun.tools.jar.Main in project jdk8u_jdk by JetBrains.

the class JarBackSlash method testJarExtract.

private static void testJarExtract(String jarFile) throws IOException {
    List<String> argList = new ArrayList<String>();
    argList.add("-xvf");
    argList.add(jarFile);
    argList.add(JARBACKSLASH + File.separatorChar + DIR + File.separatorChar + FILENAME);
    String[] jarArgs = new String[argList.size()];
    jarArgs = argList.toArray(jarArgs);
    PipedOutputStream pipedOutput = new PipedOutputStream();
    PipedInputStream pipedInput = new PipedInputStream(pipedOutput);
    PrintStream out = new PrintStream(pipedOutput);
    Main jarTool = new Main(out, System.err, "jar");
    if (!jarTool.run(jarArgs)) {
        fail("Could not list jar file.");
    }
    out.flush();
    check(pipedInput.available() > 0);
}
Also used : PrintStream(java.io.PrintStream) ArrayList(java.util.ArrayList) PipedOutputStream(java.io.PipedOutputStream) PipedInputStream(java.io.PipedInputStream) Main(sun.tools.jar.Main)

Aggregations

Main (sun.tools.jar.Main)6 PipedInputStream (java.io.PipedInputStream)2 PipedOutputStream (java.io.PipedOutputStream)2 PrintStream (java.io.PrintStream)2 ArrayList (java.util.ArrayList)2 File (java.io.File)1 PrintWriter (java.io.PrintWriter)1