1 /*
   2  * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.util.zip;
  27 
  28 /*
  29  * This class defines the constants that are used by the classes
  30  * which manipulate Zip64 files.
  31  */
  32 
  33 class ZipConstants64 {
  34 
  35     /*
  36      * ZIP64 constants
  37      */
  38     static final long ZIP64_ENDSIG = 0x06064b50L;  // "PK\006\006"
  39     static final long ZIP64_LOCSIG = 0x07064b50L;  // "PK\006\007"
  40     static final int  ZIP64_ENDHDR = 56;           // ZIP64 end header size
  41     static final int  ZIP64_LOCHDR = 20;           // ZIP64 end loc header size
  42     static final int  ZIP64_EXTHDR = 24;           // EXT header size
  43     static final int  ZIP64_EXTID  = 0x0001;       // Extra field Zip64 header ID
  44 
  45     static final int  ZIP64_MAGICCOUNT = 0xFFFF;
  46     static final long ZIP64_MAGICVAL = 0xFFFFFFFFL;
  47 
  48     /*
  49      * Zip64 End of central directory (END) header field offsets
  50      */
  51     static final int  ZIP64_ENDLEN = 4;       // size of zip64 end of central dir
  52     static final int  ZIP64_ENDVEM = 12;      // version made by
  53     static final int  ZIP64_ENDVER = 14;      // version needed to extract
  54     static final int  ZIP64_ENDNMD = 16;      // number of this disk
  55     static final int  ZIP64_ENDDSK = 20;      // disk number of start
  56     static final int  ZIP64_ENDTOD = 24;      // total number of entries on this disk
  57     static final int  ZIP64_ENDTOT = 32;      // total number of entries
  58     static final int  ZIP64_ENDSIZ = 40;      // central directory size in bytes
  59     static final int  ZIP64_ENDOFF = 48;      // offset of first CEN header
  60     static final int  ZIP64_ENDEXT = 56;      // zip64 extensible data sector
  61 
  62     /*
  63      * Zip64 End of central directory locator field offsets
  64      */
  65     static final int  ZIP64_LOCDSK = 4;       // disk number start
  66     static final int  ZIP64_LOCOFF = 8;       // offset of zip64 end
  67     static final int  ZIP64_LOCTOT = 16;      // total number of disks
  68 
  69     /*
  70      * Zip64 Extra local (EXT) header field offsets
  71      */
  72     static final int  ZIP64_EXTCRC = 4;       // uncompressed file crc-32 value
  73     static final int  ZIP64_EXTSIZ = 8;       // compressed size, 8-byte
  74     static final int  ZIP64_EXTLEN = 16;      // uncompressed size, 8-byte
  75 
  76     /*
  77      * Language encoding flag (general purpose flag bit 11)
  78      *
  79      * If this bit is set the filename and comment fields for this
  80      * entry must be encoded using UTF-8.
  81      */
  82     static final int USE_UTF8 = 0x800;
  83 
  84     /*
  85      * Constants below are defined here (instead of in ZipConstants)
  86      * to avoid being exposed as public fields of ZipFile, ZipEntry,
  87      * ZipInputStream and ZipOutputstream.
  88      */
  89 
  90     /*
  91      * Extra field header ID
  92      */
  93     static final int  EXTID_ZIP64 = 0x0001;    // Zip64
  94     static final int  EXTID_NTFS  = 0x000a;    // NTFS
  95     static final int  EXTID_UNIX  = 0x000d;    // UNIX
  96     static final int  EXTID_EXTT  = 0x5455;    // Info-ZIP Extended Timestamp
  97 
  98     /*
  99      * EXTT timestamp flags
 100      */
 101     static final int  EXTT_FLAG_LMT = 0x1;       // LastModifiedTime
 102     static final int  EXTT_FLAG_LAT = 0x2;       // LastAccessTime
 103     static final int  EXTT_FLAT_CT  = 0x4;       // CreationTime
 104 
 105     private ZipConstants64() {}
 106 }