JarOutputStream

JarOutputStream is a subclass of ZipOutputStream.

public class JarOutputStream extends ZipOutputStream

You can specify a manifest for the archive in the constructor, but this is optional. If you don't provide a manifest, none is written onto the stream:

public JarOutputStream(OutputStream out, Manifest man) throws IOException public JarOutputStream(OutputStream out) throws IOException

This class is even closer to ZipOutputStream than JarInputStream is to ZipInputStream. It overrides exactly one method, putNextEntry( ):

public void putNextEntry(ZipEntry ze) throws IOException

This is done in order to store the JAR magic number with each entry, but you don't need to know this. Other than the constructor invocation, you use this class exactly like you use ZipOutputStream.

Категории