Example usage for java.util.jar JarInputStream read

List of usage examples for java.util.jar JarInputStream read

Introduction

In this page you can find the example usage for java.util.jar JarInputStream read.

Prototype

public int read() throws IOException 

Source Link

Document

Reads a byte of uncompressed data.

Usage

From source file:org.apache.openjpa.eclipse.PluginLibrary.java

void copyJar(JarInputStream jar, JarOutputStream out) throws IOException {
    if (jar == null || out == null)
        return;//from  ww w  . ja  v a2 s.com

    try {
        JarEntry entry = null;
        while ((entry = jar.getNextJarEntry()) != null) {
            out.putNextEntry(entry);
            int b = -1;
            while ((b = jar.read()) != -1) {
                out.write(b);
            }
        }
        out.closeEntry();
    } finally {
        out.finish();
        out.flush();
        out.close();
        jar.close();
    }
}