jdk/src/java.base/share/classes/java/util/zip/ZipUtils.java
changeset 45924 8bbd04c0791e
parent 39772 c2a5d2de5253
child 46154 fcef65412084
equal deleted inserted replaced
45923:00a75e0998d1 45924:8bbd04c0791e
     1 /*
     1 /*
     2  * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2017, 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
    24  */
    24  */
    25 
    25 
    26 package java.util.zip;
    26 package java.util.zip;
    27 
    27 
    28 import java.nio.file.attribute.FileTime;
    28 import java.nio.file.attribute.FileTime;
       
    29 import java.security.AccessController;
       
    30 import java.security.PrivilegedAction;
    29 import java.time.Instant;
    31 import java.time.Instant;
    30 import java.time.LocalDateTime;
    32 import java.time.LocalDateTime;
    31 import java.time.ZoneId;
    33 import java.time.ZoneId;
    32 import java.util.concurrent.TimeUnit;
    34 import java.util.concurrent.TimeUnit;
    33 
    35 
   243     static final long CENOFF(byte[] b, int pos) { return LG(b, pos + 42);}
   245     static final long CENOFF(byte[] b, int pos) { return LG(b, pos + 42);}
   244 
   246 
   245     // The END header is followed by a variable length comment of size < 64k.
   247     // The END header is followed by a variable length comment of size < 64k.
   246     static final long END_MAXLEN = 0xFFFF + ENDHDR;
   248     static final long END_MAXLEN = 0xFFFF + ENDHDR;
   247     static final int READBLOCKSZ = 128;
   249     static final int READBLOCKSZ = 128;
       
   250 
       
   251     /**
       
   252      * Loads zip native library, if not already laoded
       
   253      */
       
   254     static void loadLibrary() {
       
   255         SecurityManager sm = System.getSecurityManager();
       
   256         if (sm == null) {
       
   257             System.loadLibrary("zip");
       
   258         } else {
       
   259             PrivilegedAction<Void> pa = () -> { System.loadLibrary("zip"); return null; };
       
   260             AccessController.doPrivileged(pa);
       
   261         }
       
   262     }
   248 }
   263 }