APIdia Launch Partner
Top Fields Constructors Methods
java.util.zip

pack-priv Class ZipUtils

extends Object
Class Inheritance
Imports
java.nio.ByteBuffer, java.nio.file.attribute.FileTime, java.time.DateTimeException, .Instant, .LocalDateTime, .ZoneId, java.util.Date, java.util.concurrent.TimeUnit, jdk.internal.access.JavaNioAccess, .SharedSecrets, jdk.internal.misc.Unsafe, jdk.internal.util.Preconditions

Field Summary

Modifier and TypeField and Description
private static final long
private static final long
pack-priv static final ByteBuffer
pack-priv static final long
pack-priv static final int
pack-priv static final JavaNioAccess
pack-priv static final int
private static final Unsafe
public static final long
UPPER_UNIXTIME_BOUND

The upper bound of the 32-bit unix time, the "year 2038 problem".

pack-priv static final int
private static final long
public static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static final int
CENATT(byte[] b, int pos)

pack-priv static final long
CENATX(byte[] b, int pos)

pack-priv static final int
CENATX_PERMS(byte[] b, int pos)

pack-priv static final int
CENCOM(byte[] b, int pos)

pack-priv static final long
CENCRC(byte[] b, int pos)

pack-priv static final int
CENDSK(byte[] b, int pos)

pack-priv static final int
CENEXT(byte[] b, int pos)

pack-priv static final int
CENFLG(byte[] b, int pos)

pack-priv static final int
CENHOW(byte[] b, int pos)

pack-priv static final long
CENLEN(byte[] b, int pos)

pack-priv static final int
CENNAM(byte[] b, int pos)

pack-priv static final long
CENOFF(byte[] b, int pos)

pack-priv static final long
CENSIG(byte[] b, int pos)

pack-priv static final long
CENSIZ(byte[] b, int pos)

pack-priv static final long
CENTIM(byte[] b, int pos)

pack-priv static final int
CENVEM(byte[] b, int pos)

pack-priv static final int
CENVEM_FA(byte[] b, int pos)

pack-priv static final int
CENVER(byte[] b, int pos)

public static long
dosToJavaTime(long dtime)

Converts DOS time to Java time (number of milliseconds since epoch).

pack-priv static final int
ENDCOM(byte[] b)

pack-priv static final int
ENDCOM(byte[] b, int off)

pack-priv static final long
ENDOFF(byte[] b)

pack-priv static final long
ENDSIZ(byte[] b)

pack-priv static final int
ENDSUB(byte[] b)

pack-priv static final int
ENDTOT(byte[] b)

pack-priv static final long
EXTCRC(byte[] b)

public static long

Returns:

milliseconds since epoch
extendedDosToJavaTime
(long
the extended DOS time value
xdostime
)

Converts extended DOS time to Java time, where up to 1999 milliseconds might be encoded into the upper half of the returned long.

pack-priv static final long
EXTLEN(byte[] b)

pack-priv static final long
EXTSIZ(byte[] b)

public static final long
fileTimeToUnixTime(FileTime ftime)

Converts FileTime to "standard Unix time".

public static final long
fileTimeToWinTime(FileTime ftime)

Converts FileTime to Windows time.

public static final int
get16(byte[] b, int off)

Fetches unsigned 16-bit value from byte array at specified offset.

public static final long
get32(byte[] b, int off)

Fetches unsigned 32-bit value from byte array at specified offset.

public static final int
get32S(byte[] b, int off)

Fetches signed 32-bit value from byte array at specified offset.

public static final long
get64S(byte[] b, int off)

Fetches signed 64-bit value from byte array at specified offset.

pack-priv static byte[]
pack-priv static int
pack-priv static LocalDateTime
private static long
javaToDosTime(LocalDateTime ldt)

Converts Java time to DOS time.

pack-priv static long

Returns:

DOS time with 2s remainder encoded into upper half
javaToExtendedDosTime
(long
milliseconds since epoch
time
)

Converts Java time to DOS time, encoding any milliseconds lost in the conversion into the upper half of the returned long.

pack-priv static void
loadLibrary()

Loads ZIP native library, if not already loaded

pack-priv static final long
LOCCRC(byte[] b)

pack-priv static final int
LOCEXT(byte[] b)

pack-priv static final int
LOCFLG(byte[] b)

pack-priv static final int
LOCHOW(byte[] b)

pack-priv static final long
LOCLEN(byte[] b)

pack-priv static final int
LOCNAM(byte[] b)

pack-priv static final long
LOCSIG(byte[] b)

pack-priv static final long
LOCSIZ(byte[] b)

pack-priv static final long
LOCTIM(byte[] b)

pack-priv static final int
LOCVER(byte[] b)

private static long
overflowDosToJavaTime(int year, int month, int day, int hour, int minute, int second)

public static final FileTime
unixTimeToFileTime(long utime)

Converts "standard Unix time"(in seconds, UTC/GMT) to FileTime

public static final FileTime
winTimeToFileTime(long wtime)

Converts Windows time (in microseconds, UTC/GMT) time to FileTime.

pack-priv static final long
ZIP64_ENDOFF(byte[] b)

pack-priv static final long
ZIP64_ENDSIZ(byte[] b)

pack-priv static final long
ZIP64_ENDTOD(byte[] b)

pack-priv static final long
ZIP64_ENDTOT(byte[] b)

pack-priv static final long
ZIP64_LOCOFF(byte[] b)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

byteBufferArrayOffsetback to summary
private static final long byteBufferArrayOffset
byteBufferOffsetOffsetback to summary
private static final long byteBufferOffsetOffset
defaultBufback to summary
pack-priv static final ByteBuffer defaultBuf
END_MAXLENback to summary
pack-priv static final long END_MAXLEN
FILE_ATTRIBUTES_UNIXback to summary
pack-priv static final int FILE_ATTRIBUTES_UNIX
NIO_ACCESSback to summary
pack-priv static final JavaNioAccess NIO_ACCESS
READBLOCKSZback to summary
pack-priv static final int READBLOCKSZ
UNSAFEback to summary
private static final Unsafe UNSAFE
UPPER_UNIXTIME_BOUNDback to summary
public static final long UPPER_UNIXTIME_BOUND

The upper bound of the 32-bit unix time, the "year 2038 problem".

VERSION_MADE_BY_BASE_UNIXback to summary
pack-priv static final int VERSION_MADE_BY_BASE_UNIX
WINDOWS_EPOCH_IN_MICROSECONDSback to summary
private static final long WINDOWS_EPOCH_IN_MICROSECONDS
WINDOWS_TIME_NOT_AVAILABLEback to summary
public static final long WINDOWS_TIME_NOT_AVAILABLE

Constructor Detail

ZipUtilsback to summary
pack-priv ZipUtils()

Method Detail

CENATTback to summary
pack-priv static final int CENATT(byte[] b, int pos)
CENATXback to summary
pack-priv static final long CENATX(byte[] b, int pos)
CENATX_PERMSback to summary
pack-priv static final int CENATX_PERMS(byte[] b, int pos)
CENCOMback to summary
pack-priv static final int CENCOM(byte[] b, int pos)
CENCRCback to summary
pack-priv static final long CENCRC(byte[] b, int pos)
CENDSKback to summary
pack-priv static final int CENDSK(byte[] b, int pos)
CENEXTback to summary
pack-priv static final int CENEXT(byte[] b, int pos)
CENFLGback to summary
pack-priv static final int CENFLG(byte[] b, int pos)
CENHOWback to summary
pack-priv static final int CENHOW(byte[] b, int pos)
CENLENback to summary
pack-priv static final long CENLEN(byte[] b, int pos)
CENNAMback to summary
pack-priv static final int CENNAM(byte[] b, int pos)
CENOFFback to summary
pack-priv static final long CENOFF(byte[] b, int pos)
CENSIGback to summary
pack-priv static final long CENSIG(byte[] b, int pos)
CENSIZback to summary
pack-priv static final long CENSIZ(byte[] b, int pos)
CENTIMback to summary
pack-priv static final long CENTIM(byte[] b, int pos)
CENVEMback to summary
pack-priv static final int CENVEM(byte[] b, int pos)
CENVEM_FAback to summary
pack-priv static final int CENVEM_FA(byte[] b, int pos)
CENVERback to summary
pack-priv static final int CENVER(byte[] b, int pos)
dosToJavaTimeback to summary
public static long dosToJavaTime(long dtime)

Converts DOS time to Java time (number of milliseconds since epoch).

ENDCOMback to summary
pack-priv static final int ENDCOM(byte[] b)
ENDCOMback to summary
pack-priv static final int ENDCOM(byte[] b, int off)
ENDOFFback to summary
pack-priv static final long ENDOFF(byte[] b)
ENDSIZback to summary
pack-priv static final long ENDSIZ(byte[] b)
ENDSUBback to summary
pack-priv static final int ENDSUB(byte[] b)
ENDTOTback to summary
pack-priv static final int ENDTOT(byte[] b)
EXTCRCback to summary
pack-priv static final long EXTCRC(byte[] b)
extendedDosToJavaTimeback to summary
public static long extendedDosToJavaTime(long xdostime)

Converts extended DOS time to Java time, where up to 1999 milliseconds might be encoded into the upper half of the returned long.

Parameters
xdostime:long

the extended DOS time value

Returns:long

milliseconds since epoch

EXTLENback to summary
pack-priv static final long EXTLEN(byte[] b)
EXTSIZback to summary
pack-priv static final long EXTSIZ(byte[] b)
fileTimeToUnixTimeback to summary
public static final long fileTimeToUnixTime(FileTime ftime)

Converts FileTime to "standard Unix time".

fileTimeToWinTimeback to summary
public static final long fileTimeToWinTime(FileTime ftime)

Converts FileTime to Windows time.

get16back to summary
public static final int get16(byte[] b, int off)

Fetches unsigned 16-bit value from byte array at specified offset. The bytes are assumed to be in Intel (little-endian) byte order.

get32back to summary
public static final long get32(byte[] b, int off)

Fetches unsigned 32-bit value from byte array at specified offset. The bytes are assumed to be in Intel (little-endian) byte order.

get32Sback to summary
public static final int get32S(byte[] b, int off)

Fetches signed 32-bit value from byte array at specified offset. The bytes are assumed to be in Intel (little-endian) byte order.

get64Sback to summary
public static final long get64S(byte[] b, int off)

Fetches signed 64-bit value from byte array at specified offset. The bytes are assumed to be in Intel (little-endian) byte order.

getBufferArrayback to summary
pack-priv static byte[] getBufferArray(ByteBuffer byteBuffer)
getBufferOffsetback to summary
pack-priv static int getBufferOffset(ByteBuffer byteBuffer)
javaEpochToLocalDateTimeback to summary
pack-priv static LocalDateTime javaEpochToLocalDateTime(long time)
javaToDosTimeback to summary
private static long javaToDosTime(LocalDateTime ldt)

Converts Java time to DOS time.

javaToExtendedDosTimeback to summary
pack-priv static long javaToExtendedDosTime(long time)

Converts Java time to DOS time, encoding any milliseconds lost in the conversion into the upper half of the returned long.

Parameters
time:long

milliseconds since epoch

Returns:long

DOS time with 2s remainder encoded into upper half

loadLibraryback to summary
pack-priv static void loadLibrary()

Loads ZIP native library, if not already loaded

LOCCRCback to summary
pack-priv static final long LOCCRC(byte[] b)
LOCEXTback to summary
pack-priv static final int LOCEXT(byte[] b)
LOCFLGback to summary
pack-priv static final int LOCFLG(byte[] b)
LOCHOWback to summary
pack-priv static final int LOCHOW(byte[] b)
LOCLENback to summary
pack-priv static final long LOCLEN(byte[] b)
LOCNAMback to summary
pack-priv static final int LOCNAM(byte[] b)
LOCSIGback to summary
pack-priv static final long LOCSIG(byte[] b)
LOCSIZback to summary
pack-priv static final long LOCSIZ(byte[] b)
LOCTIMback to summary
pack-priv static final long LOCTIM(byte[] b)
LOCVERback to summary
pack-priv static final int LOCVER(byte[] b)
overflowDosToJavaTimeback to summary
private static long overflowDosToJavaTime(int year, int month, int day, int hour, int minute, int second)
Annotations
@SuppressWarnings:deprecation
unixTimeToFileTimeback to summary
public static final FileTime unixTimeToFileTime(long utime)

Converts "standard Unix time"(in seconds, UTC/GMT) to FileTime

winTimeToFileTimeback to summary
public static final FileTime winTimeToFileTime(long wtime)

Converts Windows time (in microseconds, UTC/GMT) time to FileTime.

ZIP64_ENDOFFback to summary
pack-priv static final long ZIP64_ENDOFF(byte[] b)
ZIP64_ENDSIZback to summary
pack-priv static final long ZIP64_ENDSIZ(byte[] b)
ZIP64_ENDTODback to summary
pack-priv static final long ZIP64_ENDTOD(byte[] b)
ZIP64_ENDTOTback to summary
pack-priv static final long ZIP64_ENDTOT(byte[] b)
ZIP64_LOCOFFback to summary
pack-priv static final long ZIP64_LOCOFF(byte[] b)