Java IO Tutorial - Java Pack200.newPacker()








Syntax

Pack200.newPacker() has the following syntax.

public static Pack200.Packer newPacker()

Example

In the following code shows how to use Pack200.newPacker() method.

//  w  ww  .j  a v  a2  s .c  om

import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.jar.JarFile;
import java.util.jar.Pack200;

public class Main {
  public static void main(String[] args) throws Exception {
    JarFile f = new JarFile("a.jar");
    Pack200.Packer packer = Pack200.newPacker();
    OutputStream out = new FileOutputStream("a.pack");
    packer.pack(f, out);
    out.close();
  }
}