jdk/src/java.base/share/classes/java/util/zip/ZipUtils.java
author sherman
Tue, 08 Dec 2015 16:43:58 -0800
changeset 34526 f1f852f5f477
parent 34525 14d2d84cae6d
child 34686 29ea8310a27a
permissions -rw-r--r--
8144958: changes by JDK-8142508 seems to have broken jtreg Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
     1
/*
29226
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
     2
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
     4
 *
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    10
 *
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    15
 * accompanied this code).
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    16
 *
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    20
 *
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    23
 * questions.
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    24
 */
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    25
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    26
package java.util.zip;
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    27
19374
6773349693eb 8015666: test/tools/pack200/TimeStamp.java failing
sherman
parents: 17910
diff changeset
    28
import java.nio.file.attribute.FileTime;
33405
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
    29
import java.time.Instant;
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
    30
import java.time.LocalDateTime;
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
    31
import java.time.ZoneId;
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    32
import java.util.concurrent.TimeUnit;
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    33
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    34
class ZipUtils {
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    35
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    36
    // used to adjust values between Windows and java epoch
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    37
    private static final long WINDOWS_EPOCH_IN_MICROSECONDS = -11644473600000000L;
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    38
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    39
    /**
19374
6773349693eb 8015666: test/tools/pack200/TimeStamp.java failing
sherman
parents: 17910
diff changeset
    40
     * Converts Windows time (in microseconds, UTC/GMT) time to FileTime.
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    41
     */
19374
6773349693eb 8015666: test/tools/pack200/TimeStamp.java failing
sherman
parents: 17910
diff changeset
    42
    public static final FileTime winTimeToFileTime(long wtime) {
6773349693eb 8015666: test/tools/pack200/TimeStamp.java failing
sherman
parents: 17910
diff changeset
    43
        return FileTime.from(wtime / 10 + WINDOWS_EPOCH_IN_MICROSECONDS,
6773349693eb 8015666: test/tools/pack200/TimeStamp.java failing
sherman
parents: 17910
diff changeset
    44
                             TimeUnit.MICROSECONDS);
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    45
    }
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    46
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    47
    /**
19374
6773349693eb 8015666: test/tools/pack200/TimeStamp.java failing
sherman
parents: 17910
diff changeset
    48
     * Converts FileTime to Windows time.
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    49
     */
19374
6773349693eb 8015666: test/tools/pack200/TimeStamp.java failing
sherman
parents: 17910
diff changeset
    50
    public static final long fileTimeToWinTime(FileTime ftime) {
6773349693eb 8015666: test/tools/pack200/TimeStamp.java failing
sherman
parents: 17910
diff changeset
    51
        return (ftime.to(TimeUnit.MICROSECONDS) - WINDOWS_EPOCH_IN_MICROSECONDS) * 10;
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    52
    }
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    53
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    54
    /**
19374
6773349693eb 8015666: test/tools/pack200/TimeStamp.java failing
sherman
parents: 17910
diff changeset
    55
     * Converts "standard Unix time"(in seconds, UTC/GMT) to FileTime
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    56
     */
19374
6773349693eb 8015666: test/tools/pack200/TimeStamp.java failing
sherman
parents: 17910
diff changeset
    57
    public static final FileTime unixTimeToFileTime(long utime) {
6773349693eb 8015666: test/tools/pack200/TimeStamp.java failing
sherman
parents: 17910
diff changeset
    58
        return FileTime.from(utime, TimeUnit.SECONDS);
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    59
    }
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    60
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    61
    /**
19374
6773349693eb 8015666: test/tools/pack200/TimeStamp.java failing
sherman
parents: 17910
diff changeset
    62
     * Converts FileTime to "standard Unix time".
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    63
     */
19374
6773349693eb 8015666: test/tools/pack200/TimeStamp.java failing
sherman
parents: 17910
diff changeset
    64
    public static final long fileTimeToUnixTime(FileTime ftime) {
6773349693eb 8015666: test/tools/pack200/TimeStamp.java failing
sherman
parents: 17910
diff changeset
    65
        return ftime.to(TimeUnit.SECONDS);
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    66
    }
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    67
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    68
    /**
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    69
     * Converts DOS time to Java time (number of milliseconds since epoch).
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    70
     */
33405
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
    71
    public static long dosToJavaTime(long dtime) {
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
    72
        LocalDateTime ldt = LocalDateTime.of(
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
    73
                (int) (((dtime >> 25) & 0x7f) + 1980),
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
    74
                (int) ((dtime >> 21) & 0x0f),
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
    75
                (int) ((dtime >> 16) & 0x1f),
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
    76
                (int) ((dtime >> 11) & 0x1f),
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
    77
                (int) ((dtime >> 5) & 0x3f),
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
    78
                (int) ((dtime << 1) & 0x3e));
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
    79
        return TimeUnit.MILLISECONDS.convert(ldt.toEpochSecond(
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
    80
                ZoneId.systemDefault().getRules().getOffset(ldt)), TimeUnit.SECONDS);
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    81
    }
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    82
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    83
    /**
29226
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
    84
     * Converts extended DOS time to Java time, where up to 1999 milliseconds
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
    85
     * might be encoded into the upper half of the returned long.
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
    86
     *
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
    87
     * @param xdostime the extended DOS time value
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
    88
     * @return milliseconds since epoch
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
    89
     */
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
    90
    public static long extendedDosToJavaTime(long xdostime) {
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
    91
        long time = dosToJavaTime(xdostime);
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
    92
        return time + (xdostime >> 32);
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
    93
    }
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
    94
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
    95
    /**
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    96
     * Converts Java time to DOS time.
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
    97
     */
29226
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
    98
    private static long javaToDosTime(long time) {
33405
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
    99
        Instant instant = Instant.ofEpochMilli(time);
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
   100
        LocalDateTime ldt = LocalDateTime.ofInstant(
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
   101
                instant, ZoneId.systemDefault());
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
   102
        int year = ldt.getYear() - 1980;
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
   103
        if (year < 0) {
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
   104
            return (1 << 21) | (1 << 16);
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   105
        }
33405
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
   106
        return (year << 25 |
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
   107
            ldt.getMonthValue() << 21 |
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
   108
            ldt.getDayOfMonth() << 16 |
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
   109
            ldt.getHour() << 11 |
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
   110
            ldt.getMinute() << 5 |
24ee3a0ba28f 8066644: Fix deprecation warnings in jdk.zipfs module
redestad
parents: 31820
diff changeset
   111
            ldt.getSecond() >> 1) & 0xffffffffL;
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   112
    }
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   113
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   114
    /**
29226
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   115
     * Converts Java time to DOS time, encoding any milliseconds lost
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   116
     * in the conversion into the upper half of the returned long.
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   117
     *
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   118
     * @param time milliseconds since epoch
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   119
     * @return DOS time with 2s remainder encoded into upper half
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   120
     */
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   121
    public static long javaToExtendedDosTime(long time) {
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   122
        if (time < 0) {
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   123
            return ZipEntry.DOSTIME_BEFORE_1980;
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   124
        }
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   125
        long dostime = javaToDosTime(time);
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   126
        return (dostime != ZipEntry.DOSTIME_BEFORE_1980)
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   127
                ? dostime + ((time % 2000) << 32)
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   128
                : ZipEntry.DOSTIME_BEFORE_1980;
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   129
    }
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   130
b675016fabfd 8073497: Lazy conversion of ZipEntry time
redestad
parents: 25859
diff changeset
   131
    /**
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   132
     * Fetches unsigned 16-bit value from byte array at specified offset.
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   133
     * The bytes are assumed to be in Intel (little-endian) byte order.
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   134
     */
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   135
    public static final int get16(byte b[], int off) {
34526
f1f852f5f477 8144958: changes by JDK-8142508 seems to have broken jtreg
sherman
parents: 34525
diff changeset
   136
        return Byte.toUnsignedInt(b[off]) | (Byte.toUnsignedInt(b[off+1]) << 8);
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   137
    }
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   138
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   139
    /**
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   140
     * Fetches unsigned 32-bit value from byte array at specified offset.
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   141
     * The bytes are assumed to be in Intel (little-endian) byte order.
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   142
     */
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   143
    public static final long get32(byte b[], int off) {
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   144
        return (get16(b, off) | ((long)get16(b, off+2) << 16)) & 0xffffffffL;
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   145
    }
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   146
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   147
    /**
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   148
     * Fetches signed 64-bit value from byte array at specified offset.
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   149
     * The bytes are assumed to be in Intel (little-endian) byte order.
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   150
     */
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   151
    public static final long get64(byte b[], int off) {
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   152
        return get32(b, off) | (get32(b, off+4) << 32);
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   153
    }
31819
ba7cde5a611a 8075526: Need a way to read and write ZipEntry timestamp using local date/time without tz conversion
sherman
parents: 29226
diff changeset
   154
ba7cde5a611a 8075526: Need a way to read and write ZipEntry timestamp using local date/time without tz conversion
sherman
parents: 29226
diff changeset
   155
    /**
ba7cde5a611a 8075526: Need a way to read and write ZipEntry timestamp using local date/time without tz conversion
sherman
parents: 29226
diff changeset
   156
     * Fetches signed 32-bit value from byte array at specified offset.
ba7cde5a611a 8075526: Need a way to read and write ZipEntry timestamp using local date/time without tz conversion
sherman
parents: 29226
diff changeset
   157
     * The bytes are assumed to be in Intel (little-endian) byte order.
ba7cde5a611a 8075526: Need a way to read and write ZipEntry timestamp using local date/time without tz conversion
sherman
parents: 29226
diff changeset
   158
     *
ba7cde5a611a 8075526: Need a way to read and write ZipEntry timestamp using local date/time without tz conversion
sherman
parents: 29226
diff changeset
   159
     */
ba7cde5a611a 8075526: Need a way to read and write ZipEntry timestamp using local date/time without tz conversion
sherman
parents: 29226
diff changeset
   160
    public static final int get32S(byte b[], int off) {
ba7cde5a611a 8075526: Need a way to read and write ZipEntry timestamp using local date/time without tz conversion
sherman
parents: 29226
diff changeset
   161
        return (get16(b, off) | (get16(b, off+2) << 16));
ba7cde5a611a 8075526: Need a way to read and write ZipEntry timestamp using local date/time without tz conversion
sherman
parents: 29226
diff changeset
   162
    }
17910
82d10099a8a6 4759491: method ZipEntry.setTime(long) works incorrectly
sherman
parents:
diff changeset
   163
}