1 /*
2 * Copyright (c) 2009, 2018, 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
213 static final long EXTLEN(byte[] b) { return LG(b, 12);} // uncompressed size
214
215 // end of central directory header (END) fields
216 static final int ENDSUB(byte[] b) { return SH(b, 8); } // number of entries on this disk
217 static final int ENDTOT(byte[] b) { return SH(b, 10);} // total number of entries
218 static final long ENDSIZ(byte[] b) { return LG(b, 12);} // central directory size
219 static final long ENDOFF(byte[] b) { return LG(b, 16);} // central directory offset
220 static final int ENDCOM(byte[] b) { return SH(b, 20);} // size of zip file comment
221 static final int ENDCOM(byte[] b, int off) { return SH(b, off + 20);}
222
223 // zip64 end of central directory recoder fields
224 static final long ZIP64_ENDTOD(byte[] b) { return LL(b, 24);} // total number of entries on disk
225 static final long ZIP64_ENDTOT(byte[] b) { return LL(b, 32);} // total number of entries
226 static final long ZIP64_ENDSIZ(byte[] b) { return LL(b, 40);} // central directory size
227 static final long ZIP64_ENDOFF(byte[] b) { return LL(b, 48);} // central directory offset
228 static final long ZIP64_LOCOFF(byte[] b) { return LL(b, 8);} // zip64 end offset
229
230 // central directory header (CEN) fields
231 static final long CENSIG(byte[] b, int pos) { return LG(b, pos + 0); }
232 static final int CENVEM(byte[] b, int pos) { return SH(b, pos + 4); }
233 static final int CENVER(byte[] b, int pos) { return SH(b, pos + 6); }
234 static final int CENFLG(byte[] b, int pos) { return SH(b, pos + 8); }
235 static final int CENHOW(byte[] b, int pos) { return SH(b, pos + 10);}
236 static final long CENTIM(byte[] b, int pos) { return LG(b, pos + 12);}
237 static final long CENCRC(byte[] b, int pos) { return LG(b, pos + 16);}
238 static final long CENSIZ(byte[] b, int pos) { return LG(b, pos + 20);}
239 static final long CENLEN(byte[] b, int pos) { return LG(b, pos + 24);}
240 static final int CENNAM(byte[] b, int pos) { return SH(b, pos + 28);}
241 static final int CENEXT(byte[] b, int pos) { return SH(b, pos + 30);}
242 static final int CENCOM(byte[] b, int pos) { return SH(b, pos + 32);}
243 static final int CENDSK(byte[] b, int pos) { return SH(b, pos + 34);}
244 static final int CENATT(byte[] b, int pos) { return SH(b, pos + 36);}
245 static final long CENATX(byte[] b, int pos) { return LG(b, pos + 38);}
246 static final long CENOFF(byte[] b, int pos) { return LG(b, pos + 42);}
247
248 /* The END header is followed by a variable length comment of size < 64k. */
249 static final long END_MAXLEN = 0xFFFF + ENDHDR;
250 static final int READBLOCKSZ = 128;
251 }
|
1 /*
2 * Copyright (c) 2009, 2019, 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
213 static final long EXTLEN(byte[] b) { return LG(b, 12);} // uncompressed size
214
215 // end of central directory header (END) fields
216 static final int ENDSUB(byte[] b) { return SH(b, 8); } // number of entries on this disk
217 static final int ENDTOT(byte[] b) { return SH(b, 10);} // total number of entries
218 static final long ENDSIZ(byte[] b) { return LG(b, 12);} // central directory size
219 static final long ENDOFF(byte[] b) { return LG(b, 16);} // central directory offset
220 static final int ENDCOM(byte[] b) { return SH(b, 20);} // size of zip file comment
221 static final int ENDCOM(byte[] b, int off) { return SH(b, off + 20);}
222
223 // zip64 end of central directory recoder fields
224 static final long ZIP64_ENDTOD(byte[] b) { return LL(b, 24);} // total number of entries on disk
225 static final long ZIP64_ENDTOT(byte[] b) { return LL(b, 32);} // total number of entries
226 static final long ZIP64_ENDSIZ(byte[] b) { return LL(b, 40);} // central directory size
227 static final long ZIP64_ENDOFF(byte[] b) { return LL(b, 48);} // central directory offset
228 static final long ZIP64_LOCOFF(byte[] b) { return LL(b, 8);} // zip64 end offset
229
230 // central directory header (CEN) fields
231 static final long CENSIG(byte[] b, int pos) { return LG(b, pos + 0); }
232 static final int CENVEM(byte[] b, int pos) { return SH(b, pos + 4); }
233 static final int CENVEM_FA(byte[] b, int pos) { return CH(b, pos + 5); }
234 static final int CENVER(byte[] b, int pos) { return SH(b, pos + 6); }
235 static final int CENFLG(byte[] b, int pos) { return SH(b, pos + 8); }
236 static final int CENHOW(byte[] b, int pos) { return SH(b, pos + 10);}
237 static final long CENTIM(byte[] b, int pos) { return LG(b, pos + 12);}
238 static final long CENCRC(byte[] b, int pos) { return LG(b, pos + 16);}
239 static final long CENSIZ(byte[] b, int pos) { return LG(b, pos + 20);}
240 static final long CENLEN(byte[] b, int pos) { return LG(b, pos + 24);}
241 static final int CENNAM(byte[] b, int pos) { return SH(b, pos + 28);}
242 static final int CENEXT(byte[] b, int pos) { return SH(b, pos + 30);}
243 static final int CENCOM(byte[] b, int pos) { return SH(b, pos + 32);}
244 static final int CENDSK(byte[] b, int pos) { return SH(b, pos + 34);}
245 static final int CENATT(byte[] b, int pos) { return SH(b, pos + 36);}
246 static final long CENATX(byte[] b, int pos) { return LG(b, pos + 38);}
247 static final int CENATX_PERMS(byte[] b, int pos) { return SH(b, pos + 40);}
248 static final long CENOFF(byte[] b, int pos) { return LG(b, pos + 42);}
249
250 /* The END header is followed by a variable length comment of size < 64k. */
251 static final long END_MAXLEN = 0xFFFF + ENDHDR;
252 static final int READBLOCKSZ = 128;
253 }
|