src/share/classes/java/util/zip/ZipOutputStream.java

Print this page
rev 3186 : 6880112: Project Coin: Port JDK core library code to use diamond operator


  35 /**
  36  * This class implements an output stream filter for writing files in the
  37  * ZIP file format. Includes support for both compressed and uncompressed
  38  * entries.
  39  *
  40  * @author      David Connelly
  41  */
  42 public
  43 class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
  44 
  45     private static class XEntry {
  46         public final ZipEntry entry;
  47         public final long offset;
  48         public XEntry(ZipEntry entry, long offset) {
  49             this.entry = entry;
  50             this.offset = offset;
  51         }
  52     }
  53 
  54     private XEntry current;
  55     private Vector<XEntry> xentries = new Vector<XEntry>();
  56     private HashSet<String> names = new HashSet<String>();
  57     private CRC32 crc = new CRC32();
  58     private long written = 0;
  59     private long locoff = 0;
  60     private byte[] comment;
  61     private int method = DEFLATED;
  62     private boolean finished;
  63 
  64     private boolean closed = false;
  65 
  66     private final ZipCoder zc;
  67 
  68     private static int version(ZipEntry e) throws ZipException {
  69         switch (e.method) {
  70         case DEFLATED: return 20;
  71         case STORED:   return 10;
  72         default: throw new ZipException("unsupported compression method");
  73         }
  74     }
  75 
  76     /**




  35 /**
  36  * This class implements an output stream filter for writing files in the
  37  * ZIP file format. Includes support for both compressed and uncompressed
  38  * entries.
  39  *
  40  * @author      David Connelly
  41  */
  42 public
  43 class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
  44 
  45     private static class XEntry {
  46         public final ZipEntry entry;
  47         public final long offset;
  48         public XEntry(ZipEntry entry, long offset) {
  49             this.entry = entry;
  50             this.offset = offset;
  51         }
  52     }
  53 
  54     private XEntry current;
  55     private Vector<XEntry> xentries = new Vector<>();
  56     private HashSet<String> names = new HashSet<>();
  57     private CRC32 crc = new CRC32();
  58     private long written = 0;
  59     private long locoff = 0;
  60     private byte[] comment;
  61     private int method = DEFLATED;
  62     private boolean finished;
  63 
  64     private boolean closed = false;
  65 
  66     private final ZipCoder zc;
  67 
  68     private static int version(ZipEntry e) throws ZipException {
  69         switch (e.method) {
  70         case DEFLATED: return 20;
  71         case STORED:   return 10;
  72         default: throw new ZipException("unsupported compression method");
  73         }
  74     }
  75 
  76     /**