jdk/src/java.base/share/classes/java/util/zip/ZipUtils.java
changeset 39772 c2a5d2de5253
parent 34686 29ea8310a27a
child 45924 8bbd04c0791e
equal deleted inserted replaced
39771:ab558f578f30 39772:c2a5d2de5253
     1 /*
     1 /*
     2  * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2016, 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
    36 class ZipUtils {
    36 class ZipUtils {
    37 
    37 
    38     // used to adjust values between Windows and java epoch
    38     // used to adjust values between Windows and java epoch
    39     private static final long WINDOWS_EPOCH_IN_MICROSECONDS = -11644473600000000L;
    39     private static final long WINDOWS_EPOCH_IN_MICROSECONDS = -11644473600000000L;
    40 
    40 
       
    41     // used to indicate the corresponding windows time is not available
       
    42     public static final long WINDOWS_TIME_NOT_AVAILABLE = Long.MIN_VALUE;
       
    43 
    41     /**
    44     /**
    42      * Converts Windows time (in microseconds, UTC/GMT) time to FileTime.
    45      * Converts Windows time (in microseconds, UTC/GMT) time to FileTime.
    43      */
    46      */
    44     public static final FileTime winTimeToFileTime(long wtime) {
    47     public static final FileTime winTimeToFileTime(long wtime) {
    45         return FileTime.from(wtime / 10 + WINDOWS_EPOCH_IN_MICROSECONDS,
    48         return FileTime.from(wtime / 10 + WINDOWS_EPOCH_IN_MICROSECONDS,
    50      * Converts FileTime to Windows time.
    53      * Converts FileTime to Windows time.
    51      */
    54      */
    52     public static final long fileTimeToWinTime(FileTime ftime) {
    55     public static final long fileTimeToWinTime(FileTime ftime) {
    53         return (ftime.to(TimeUnit.MICROSECONDS) - WINDOWS_EPOCH_IN_MICROSECONDS) * 10;
    56         return (ftime.to(TimeUnit.MICROSECONDS) - WINDOWS_EPOCH_IN_MICROSECONDS) * 10;
    54     }
    57     }
       
    58 
       
    59     /**
       
    60      * The upper bound of the 32-bit unix time, the "year 2038 problem".
       
    61      */
       
    62     public static final long UPPER_UNIXTIME_BOUND = 0x7fffffff;
    55 
    63 
    56     /**
    64     /**
    57      * Converts "standard Unix time"(in seconds, UTC/GMT) to FileTime
    65      * Converts "standard Unix time"(in seconds, UTC/GMT) to FileTime
    58      */
    66      */
    59     public static final FileTime unixTimeToFileTime(long utime) {
    67     public static final FileTime unixTimeToFileTime(long utime) {