src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipConstants.java
changeset 57665 bf325b739c8a
parent 53043 fd2e8f941ded
equal deleted inserted replaced
57664:1d2ea8db7083 57665:bf325b739c8a
     1 /*
     1 /*
     2  * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
     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.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    61      */
    61      */
    62     static final int LOCHDR = 30;       // LOC header size
    62     static final int LOCHDR = 30;       // LOC header size
    63     static final int EXTHDR = 16;       // EXT header size
    63     static final int EXTHDR = 16;       // EXT header size
    64     static final int CENHDR = 46;       // CEN header size
    64     static final int CENHDR = 46;       // CEN header size
    65     static final int ENDHDR = 22;       // END header size
    65     static final int ENDHDR = 22;       // END header size
       
    66 
       
    67     /*
       
    68      * File attribute compatibility types of CEN field "version made by"
       
    69      */
       
    70     static final int FILE_ATTRIBUTES_UNIX = 3; // Unix
       
    71 
       
    72     /*
       
    73      * Base values for CEN field "version made by"
       
    74      */
       
    75     static final int VERSION_MADE_BY_BASE_UNIX = FILE_ATTRIBUTES_UNIX << 8; // Unix
    66 
    76 
    67     /*
    77     /*
    68      * Local file (LOC) header field offsets
    78      * Local file (LOC) header field offsets
    69      */
    79      */
    70     static final int LOCVER = 4;        // version needed to extract
    80     static final int LOCVER = 4;        // version needed to extract
   226     static final long ZIP64_ENDSIZ(byte[] b) { return LL(b, 40);}  // central directory size
   236     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
   237     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
   238     static final long ZIP64_LOCOFF(byte[] b) { return LL(b, 8);}   // zip64 end offset
   229 
   239 
   230     // central directory header (CEN) fields
   240     // central directory header (CEN) fields
   231     static final long CENSIG(byte[] b, int pos) { return LG(b, pos + 0); }
   241     static final long CENSIG(byte[] b, int pos) { return LG(b, pos + 0); } // signature
   232     static final int  CENVEM(byte[] b, int pos) { return SH(b, pos + 4); }
   242     static final int  CENVEM(byte[] b, int pos) { return SH(b, pos + 4); } // version made by
   233     static final int  CENVER(byte[] b, int pos) { return SH(b, pos + 6); }
   243     static final int  CENVEM_FA(byte[] b, int pos) { return CH(b, pos + 5); } // file attribute compatibility
   234     static final int  CENFLG(byte[] b, int pos) { return SH(b, pos + 8); }
   244     static final int  CENVER(byte[] b, int pos) { return SH(b, pos + 6); } // version needed to extract
   235     static final int  CENHOW(byte[] b, int pos) { return SH(b, pos + 10);}
   245     static final int  CENFLG(byte[] b, int pos) { return SH(b, pos + 8); } // encrypt, decrypt flags
   236     static final long CENTIM(byte[] b, int pos) { return LG(b, pos + 12);}
   246     static final int  CENHOW(byte[] b, int pos) { return SH(b, pos + 10);} // compression method
   237     static final long CENCRC(byte[] b, int pos) { return LG(b, pos + 16);}
   247     static final long CENTIM(byte[] b, int pos) { return LG(b, pos + 12);} // modification time
   238     static final long CENSIZ(byte[] b, int pos) { return LG(b, pos + 20);}
   248     static final long CENCRC(byte[] b, int pos) { return LG(b, pos + 16);} // uncompressed file crc-32 value
   239     static final long CENLEN(byte[] b, int pos) { return LG(b, pos + 24);}
   249     static final long CENSIZ(byte[] b, int pos) { return LG(b, pos + 20);} // compressed size
   240     static final int  CENNAM(byte[] b, int pos) { return SH(b, pos + 28);}
   250     static final long CENLEN(byte[] b, int pos) { return LG(b, pos + 24);} // uncompressed size
   241     static final int  CENEXT(byte[] b, int pos) { return SH(b, pos + 30);}
   251     static final int  CENNAM(byte[] b, int pos) { return SH(b, pos + 28);} // filename length
   242     static final int  CENCOM(byte[] b, int pos) { return SH(b, pos + 32);}
   252     static final int  CENEXT(byte[] b, int pos) { return SH(b, pos + 30);} // extra field length
   243     static final int  CENDSK(byte[] b, int pos) { return SH(b, pos + 34);}
   253     static final int  CENCOM(byte[] b, int pos) { return SH(b, pos + 32);} // comment length
   244     static final int  CENATT(byte[] b, int pos) { return SH(b, pos + 36);}
   254     static final int  CENDSK(byte[] b, int pos) { return SH(b, pos + 34);} // disk number start
   245     static final long CENATX(byte[] b, int pos) { return LG(b, pos + 38);}
   255     static final int  CENATT(byte[] b, int pos) { return SH(b, pos + 36);} // internal file attributes
   246     static final long CENOFF(byte[] b, int pos) { return LG(b, pos + 42);}
   256     static final long CENATX(byte[] b, int pos) { return LG(b, pos + 38);} // external file attributes
       
   257     static final int  CENATX_PERMS(byte[] b, int pos) { return SH(b, pos + 40);} // posix permission data
       
   258     static final long CENOFF(byte[] b, int pos) { return LG(b, pos + 42);} // LOC header offset
   247 
   259 
   248     /* The END header is followed by a variable length comment of size < 64k. */
   260     /* The END header is followed by a variable length comment of size < 64k. */
   249     static final long END_MAXLEN = 0xFFFF + ENDHDR;
   261     static final long END_MAXLEN = 0xFFFF + ENDHDR;
   250     static final int READBLOCKSZ = 128;
   262     static final int READBLOCKSZ = 128;
   251 }
   263 }