| Modifier and Type | Field and Description |
|---|---|
| private static final long | DOSTIME_BEFORE_1980
DOS time constant for representing timestamps before 1980. |
| private static final long | DOSTIME_BEFORE_1980_AS_JAVA_TIME
Java time representation of the smallest date/time ZIP can handle |
| private static final long | UPPER_DOSTIME_BOUND
Approximately 128 years, in milliseconds (ignoring leap years, etc.). |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static long | Returns: the unsigned int as a long.the value to treat as unsigned int. i)Assumes a negative integer really is a positive integer that has wrapped around and re-creates the original value. |
| pack-priv static long | Returns: long representation of the BigInteger.BigInteger to convert. big)Converts a BigInteger into a long, and blows up (NumberFormatException) if the BigInteger is too big. |
| pack-priv static boolean | canHandleEntryData(final ZipArchiveEntry entry)
Tests if this library is able to read or write the given entry. |
| pack-priv static void | checkRequestedFeatures(final ZipArchiveEntry ze)
Checks whether the entry requires features not (yet) supported by the library and throws an exception if it does. |
| pack-priv static byte[] | |
| pack-priv static void | |
| private static Date | |
| public static long | Returns: converted timetime to convert dosTime)Converts DOS time to Java time (number of milliseconds since epoch). |
| public static Date | Returns: a Date instance corresponding to the given time.contains the stored DOS time. zipDosTime)Converts a DOS date/time field to a Date object. |
| private static String | getUnicodeStringIfOriginalMatches(final AbstractUnicodeExtraField f, final byte[] orig)
If the stored CRC matches the one of the given name, return the Unicode name of the given field. |
| public static boolean | Returns: true if the time can be safely represented as DOS time, false otherwisetime in milliseconds since epoch time)Tests whether a given time (in milliseconds since Epoch) can be safely represented as DOS time |
| private static LocalDateTime | |
| private static long | |
| pack-priv static BigInteger | Returns: BigInteger representation of the provided long.long to convert to BigInteger. l)Converts a long into a BigInteger. |
| public static byte[] | Returns: the reversed array (mutated in-place, but also returned for convenience).to reverse (mutated in-place, but also returned for convenience). array)Reverses a byte[] array. |
| pack-priv static void | setNameAndCommentFromExtraFields(final ZipArchiveEntry ze, final byte[] originalNameBytes, final byte[] commentBytes)
If the entry has Unicode*ExtraFields and the CRCs of the names/comments match those of the extra fields, transfer the known Unicode values from the extra field. |
| public static int | Returns: int representation of the provided bytebyte to convert to int b)Converts a signed byte into an unsigned integer representation (e.g., -1 becomes 255). |
| private static boolean | Returns: true if the entry isn't encrypted at allTests if this library supports the encryption used by the given entry. |
| private static boolean | Returns: true if the compression method is supportedTests if this library supports the compression method used by the given entry. |
| public static ZipLong | |
| public static byte[] | Returns: the date as a byte arraynumber of milliseconds since the epoch t)Converts a Date object to a DOS date/time field. |
| public static void | toDosTime(final long
number of milliseconds since the epoch t, final byte[] the output buffer buf, final int The offset within the output buffer of the first byte to be written. must be non-negative and no larger than offset)buf.length-4Converts a Date object to a DOS date/time field. |
| public static byte | Returns: byte representation of the provided intinteger to convert to byte i)Converts an unsigned integer to a signed byte (e.g., 255 becomes -1). |
| DOSTIME_BEFORE_1980 | back to summary |
|---|---|
| private static final long DOSTIME_BEFORE_1980 DOS time constant for representing timestamps before 1980. Smallest date/time ZIP can handle. MS-DOS records file dates and times as packed 16-bit values. An MS-DOS date has the following format. Bits Contents
Bits Contents
This was copied from
| |
| DOSTIME_BEFORE_1980_AS_JAVA_TIME | back to summary |
|---|---|
| private static final long DOSTIME_BEFORE_1980_AS_JAVA_TIME Java time representation of the smallest date/time ZIP can handle | |
| UPPER_DOSTIME_BOUND | back to summary |
|---|---|
| private static final long UPPER_DOSTIME_BOUND Approximately 128 years, in milliseconds (ignoring leap years, etc.). This establish an approximate high-bound value for DOS times in milliseconds since epoch, used to enable an efficient but sufficient bounds check to avoid generating extended last modified time entries. Calculating the exact number is locale dependent, would require loading TimeZone data eagerly, and would make little practical sense. Since DOS times theoretically go to 2107 - with compatibility not guaranteed after 2099 - setting this to a time that is before but near 2099 should be sufficient.
This was copied from
| |
| ZipUtil | back to summary |
|---|---|
| public ZipUtil() | |
| adjustToLong | back to summary |
|---|---|
| public static long adjustToLong(final int i) Assumes a negative integer really is a positive integer that has wrapped around and re-creates the original value.
| |
| bigToLong | back to summary |
|---|---|
| pack-priv static long bigToLong(final BigInteger big) Converts a BigInteger into a long, and blows up (NumberFormatException) if the BigInteger is too big.
| |
| canHandleEntryData | back to summary |
|---|---|
| pack-priv static boolean canHandleEntryData(final ZipArchiveEntry entry) Tests if this library is able to read or write the given entry. | |
| checkRequestedFeatures | back to summary |
|---|---|
| pack-priv static void checkRequestedFeatures(final ZipArchiveEntry ze) throws UnsupportedZipFeatureException Checks whether the entry requires features not (yet) supported by the library and throws an exception if it does. | |
| copy | back to summary |
|---|---|
| pack-priv static byte[] copy(final byte[] from) Creates a copy of the given array - or return null if the argument is null. | |
| copy | back to summary |
|---|---|
| pack-priv static void copy(final byte[] from, final byte[] to, final int offset) | |
| dosToJavaDate | back to summary |
|---|---|
| private static Date dosToJavaDate(final long dosTime) | |
| dosToJavaTime | back to summary |
|---|---|
| public static long dosToJavaTime(final long dosTime) Converts DOS time to Java time (number of milliseconds since epoch).
| |
| fromDosTime | back to summary |
|---|---|
| public static Date fromDosTime(final ZipLong zipDosTime) Converts a DOS date/time field to a Date object. | |
| getUnicodeStringIfOriginalMatches | back to summary |
|---|---|
| private static String getUnicodeStringIfOriginalMatches(final AbstractUnicodeExtraField f, final byte[] orig) If the stored CRC matches the one of the given name, return the Unicode name of the given field. If the field is null or the CRCs don't match, return null instead. | |
| isDosTime | back to summary |
|---|---|
| public static boolean isDosTime(final long time) Tests whether a given time (in milliseconds since Epoch) can be safely represented as DOS time
| |
| javaEpochToLocalDateTime | back to summary |
|---|---|
| private static LocalDateTime javaEpochToLocalDateTime(final long time) | |
| javaToDosTime | back to summary |
|---|---|
| private static long javaToDosTime(final long t) | |
| longToBig | back to summary |
|---|---|
| pack-priv static BigInteger longToBig(long l) Converts a long into a BigInteger. Negative numbers between -1 and -2^31 are treated as unsigned 32 bit (e.g., positive) integers. Negative numbers below -2^31 cause an IllegalArgumentException to be thrown.
| |
| reverse | back to summary |
|---|---|
| public static byte[] reverse(final byte[] array) Reverses a byte[] array. Reverses in-place (thus provided array is mutated), but also returns same for convenience.
| |
| setNameAndCommentFromExtraFields | back to summary |
|---|---|
| pack-priv static void setNameAndCommentFromExtraFields(final ZipArchiveEntry ze, final byte[] originalNameBytes, final byte[] commentBytes) If the entry has Unicode*ExtraFields and the CRCs of the names/comments match those of the extra fields, transfer the known Unicode values from the extra field. | |
| signedByteToUnsignedInt | back to summary |
|---|---|
| public static int signedByteToUnsignedInt(final byte b) Converts a signed byte into an unsigned integer representation (e.g., -1 becomes 255).
| |
| supportsEncryptionOf | back to summary |
|---|---|
| private static boolean supportsEncryptionOf(final ZipArchiveEntry entry) Tests if this library supports the encryption used by the given entry.
| |
| supportsMethodOf | back to summary |
|---|---|
| private static boolean supportsMethodOf(final ZipArchiveEntry entry) Tests if this library supports the compression method used by the given entry.
| |
| toDosTime | back to summary |
|---|---|
| public static ZipLong toDosTime(final Date time) Converts a Date object to a DOS date/time field. | |
| toDosTime | back to summary |
|---|---|
| public static byte[] toDosTime(final long t) Converts a Date object to a DOS date/time field.
Stolen from InfoZip's
| |
| toDosTime | back to summary |
|---|---|
| public static void toDosTime(final long t, final byte[] buf, final int offset) Converts a Date object to a DOS date/time field.
Stolen from InfoZip's
| |
| unsignedIntToSignedByte | back to summary |
|---|---|
| public static byte unsignedIntToSignedByte(final int i) Converts an unsigned integer to a signed byte (e.g., 255 becomes -1).
| |