1 /*
  2  * Copyright (c) 1995, 2020, 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 interface defines the constants that are used by the classes
 30  * which manipulate ZIP files.
 31  *
 32  * @author      David Connelly
 33  * @since 1.1
 34  */
 35 interface ZipConstants {
 36 
 37     /**
 38      * Local file (LOC) header signature.
 39      */
 40     static long LOCSIG = 0x04034b50L;   // "PK\003\004"
 41 
 42     /**
 43      * Extra local (EXT) header signature.
 44      */
 45     static long EXTSIG = 0x08074b50L;   // "PK\007\008"
 46 
 47     /**
 48      * Central directory (CEN) header signature.
 49      */
 50     static long CENSIG = 0x02014b50L;   // "PK\001\002"
 51 
 52     /**
 53      * End of central directory (END) header signature.
 54      */
 55     static long ENDSIG = 0x06054b50L;   // "PK\005\006"
 56 
 57     /**
 58      * Local file (LOC) header size in bytes (including signature).
 59      */
 60     static final int LOCHDR = 30;
 61 
 62     /**
 63      * Extra local (EXT) header size in bytes (including signature).
 64      */
 65     static final int EXTHDR = 16;
 66 
 67     /**
 68      * Central directory (CEN) header size in bytes (including signature).
 69      */
 70     static final int CENHDR = 46;
 71 
 72     /**
 73      * End of central directory (END) header size in bytes (including signature).
 74      */
 75     static final int ENDHDR = 22;
 76 
 77     /**
 78      * Local file (LOC) header version needed to extract field offset.
 79      */
 80     static final int LOCVER = 4;
 81 
 82     /**
 83      * Local file (LOC) header general purpose bit flag field offset.
 84      */
 85     static final int LOCFLG = 6;
 86 
 87     /**
 88      * Local file (LOC) header compression method field offset.
 89      */
 90     static final int LOCHOW = 8;
 91 
 92     /**
 93      * Local file (LOC) header modification time field offset.
 94      */
 95     static final int LOCTIM = 10;
 96 
 97     /**
 98      * Local file (LOC) header uncompressed file crc-32 value field offset.
 99      */
100     static final int LOCCRC = 14;
101 
102     /**
103      * Local file (LOC) header compressed size field offset.
104      */
105     static final int LOCSIZ = 18;
106 
107     /**
108      * Local file (LOC) header uncompressed size field offset.
109      */
110     static final int LOCLEN = 22;
111 
112     /**
113      * Local file (LOC) header filename length field offset.
114      */
115     static final int LOCNAM = 26;
116 
117     /**
118      * Local file (LOC) header extra field length field offset.
119      */
120     static final int LOCEXT = 28;
121 
122     /**
123      * Extra local (EXT) header uncompressed file crc-32 value field offset.
124      */
125     static final int EXTCRC = 4;
126 
127     /**
128      * Extra local (EXT) header compressed size field offset
129      */
130     static final int EXTSIZ = 8;
131 
132     /**
133      * Extra local (EXT) header uncompressed size field offset
134      */
135     static final int EXTLEN = 12;
136 
137     /**
138      * Central directory (CEN) header version made by field offset.
139      */
140     static final int CENVEM = 4;
141 
142     /**
143      * Central directory (CEN) header version needed to extract field offset.
144      */
145     static final int CENVER = 6;
146 
147     /**
148      * Central directory (CEN) header encrypt, decrypt flags field offset.
149      */
150     static final int CENFLG = 8;
151 
152     /**
153      * Central directory (CEN) header compression method field offset.
154      */
155     static final int CENHOW = 10;
156 
157     /**
158      * Central directory (CEN) header modification time field offset.
159      */
160     static final int CENTIM = 12;
161 
162     /**
163      * Central directory (CEN) header uncompressed file crc-32 value field offset.
164      */
165     static final int CENCRC = 16;
166 
167     /**
168      * Central directory (CEN) header compressed size field offset.
169      */
170     static final int CENSIZ = 20;
171 
172     /**
173      * Central directory (CEN) header uncompressed size field offset.
174      */
175     static final int CENLEN = 24;
176 
177     /**
178      * Central directory (CEN) header filename length field offset.
179      */
180     static final int CENNAM = 28;
181 
182     /**
183      * Central directory (CEN) header extra field length field offset.
184      */
185     static final int CENEXT = 30;
186 
187     /**
188      * Central directory (CEN) header comment length field offset.
189      */
190     static final int CENCOM = 32;
191 
192     /**
193      * Central directory (CEN) header disk number start field offset.
194      */
195     static final int CENDSK = 34;
196 
197     /**
198      * Central directory (CEN) header internal file attributes field offset.
199      */
200     static final int CENATT = 36;
201 
202     /**
203      * Central directory (CEN) header external file attributes field offset.
204      */
205     static final int CENATX = 38;
206 
207     /**
208      * Central directory (CEN) header LOC header offset field offset.
209      */
210     static final int CENOFF = 42;
211 
212     /**
213      * End of central directory (END) header number of entries on this disk field offset.
214      */
215     static final int ENDSUB = 8;
216 
217     /**
218      * End of central directory (END) header total number of entries field offset.
219      */
220     static final int ENDTOT = 10;
221 
222     /**
223      * End of central directory (END) header central directory size in bytes field offset.
224      */
225     static final int ENDSIZ = 12;
226 
227     /**
228      * End of central directory (END) header offset for the first CEN header field offset.
229      */
230     static final int ENDOFF = 16;
231 
232     /**
233      * End of central directory (END) header zip file comment length field offset.
234      */
235     static final int ENDCOM = 20;
236 }