Code example for JarOutputStream

Methods: putNextEntry

0
    public void test_putNextEntryLjava_util_zip_ZipEntry() throws Exception { 
        final String entryName = "foo/bar/execjartest/MainClass.class";
        Manifest newman = new Manifest();
        File outputJar = File.createTempFile("hyts_", ".jar");
        OutputStream os = new FileOutputStream(outputJar);
        JarOutputStream jout = new JarOutputStream(os, newman);
        os.close();
        try { 
            jout.putNextEntry(new JarEntry(entryName));
            fail("IOException expected");
        } catch (IOException expected) {
        } 
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java