01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.util;
05:
06: import java.io.BufferedOutputStream;
07: import java.io.File;
08: import java.io.FileOutputStream;
09: import java.io.IOException;
10: import java.util.jar.JarEntry;
11: import java.util.jar.JarOutputStream;
12: import java.util.jar.Manifest;
13: import java.util.zip.ZipEntry;
14: import java.util.zip.ZipOutputStream;
15:
16: public final class JarBuilder extends ZipBuilder {
17:
18: private boolean isInit;
19:
20: public JarBuilder(File archiveFile) throws IOException {
21: super (archiveFile, false);
22: }
23:
24: protected final ZipEntry createEntry(String name) {
25: return new JarEntry(name);
26: }
27:
28: protected final ZipOutputStream getArchiveOutputStream(
29: File archiveFile) throws IOException {
30: if (isInit)
31: super .getArchiveOutputStream(archiveFile); // throws Exception
32: isInit = true;
33: return new JarOutputStream(new BufferedOutputStream(
34: new FileOutputStream(archiveFile)), new Manifest());
35: }
36: }
|