24 */
25
26 package java.util.zip;
27
28 import java.io.OutputStream;
29 import java.io.IOException;
30 import java.nio.charset.Charset;
31 import java.nio.charset.StandardCharsets;
32 import java.util.Vector;
33 import java.util.HashSet;
34 import static java.util.zip.ZipConstants64.*;
35 import static java.util.zip.ZipUtils.*;
36 import sun.security.action.GetPropertyAction;
37
38 /**
39 * This class implements an output stream filter for writing files in the
40 * ZIP file format. Includes support for both compressed and uncompressed
41 * entries.
42 *
43 * @author David Connelly
44 */
45 public
46 class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
47
48 /**
49 * Whether to use ZIP64 for zip files with more than 64k entries.
50 * Until ZIP64 support in zip implementations is ubiquitous, this
51 * system property allows the creation of zip files which can be
52 * read by legacy zip implementations which tolerate "incorrect"
53 * total entry count fields, such as the ones in jdk6, and even
54 * some in jdk7.
55 */
56 private static final boolean inhibitZip64 =
57 Boolean.parseBoolean(
58 GetPropertyAction.privilegedGetProperty("jdk.util.zip.inhibitZip64"));
59
60 private static class XEntry {
61 final ZipEntry entry;
62 final long offset;
63 public XEntry(ZipEntry entry, long offset) {
|
24 */
25
26 package java.util.zip;
27
28 import java.io.OutputStream;
29 import java.io.IOException;
30 import java.nio.charset.Charset;
31 import java.nio.charset.StandardCharsets;
32 import java.util.Vector;
33 import java.util.HashSet;
34 import static java.util.zip.ZipConstants64.*;
35 import static java.util.zip.ZipUtils.*;
36 import sun.security.action.GetPropertyAction;
37
38 /**
39 * This class implements an output stream filter for writing files in the
40 * ZIP file format. Includes support for both compressed and uncompressed
41 * entries.
42 *
43 * @author David Connelly
44 * @since 1.1
45 */
46 public
47 class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
48
49 /**
50 * Whether to use ZIP64 for zip files with more than 64k entries.
51 * Until ZIP64 support in zip implementations is ubiquitous, this
52 * system property allows the creation of zip files which can be
53 * read by legacy zip implementations which tolerate "incorrect"
54 * total entry count fields, such as the ones in jdk6, and even
55 * some in jdk7.
56 */
57 private static final boolean inhibitZip64 =
58 Boolean.parseBoolean(
59 GetPropertyAction.privilegedGetProperty("jdk.util.zip.inhibitZip64"));
60
61 private static class XEntry {
62 final ZipEntry entry;
63 final long offset;
64 public XEntry(ZipEntry entry, long offset) {
|