public abstract class ZipUtil
extends java.lang.Object
| Constructor and Description |
|---|
ZipUtil() |
| Modifier and Type | Method and Description |
|---|---|
static long |
adjustToLong(int i)
Assumes a negative integer really is a positive integer that has wrapped around and re-creates the original value.
|
static long |
dosToJavaTime(long dosTime)
Converts DOS time to Java time (number of milliseconds since epoch).
|
static java.util.Date |
fromDosTime(ZipLong zipDosTime)
Converts a DOS date/time field to a Date object.
|
static boolean |
isDosTime(long time)
Tests whether a given time (in milliseconds since Epoch) can be safely represented as DOS time
|
static byte[] |
reverse(byte[] array)
Reverses a byte[] array.
|
static int |
signedByteToUnsignedInt(byte b)
Converts a signed byte into an unsigned integer representation (e.g., -1 becomes 255).
|
static ZipLong |
toDosTime(java.util.Date time)
Converts a Date object to a DOS date/time field.
|
static byte[] |
toDosTime(long t)
Converts a Date object to a DOS date/time field.
|
static void |
toDosTime(long t,
byte[] buf,
int offset)
Converts a Date object to a DOS date/time field.
|
static byte |
unsignedIntToSignedByte(int i)
Converts an unsigned integer to a signed byte (e.g., 255 becomes -1).
|
public static long adjustToLong(int i)
i - the value to treat as unsigned int.public static long dosToJavaTime(long dosTime)
dosTime - time to convertpublic static java.util.Date fromDosTime(ZipLong zipDosTime)
zipDosTime - contains the stored DOS time.public static boolean isDosTime(long time)
time - time in milliseconds since epochpublic static byte[] reverse(byte[] array)
array - to reverse (mutated in-place, but also returned for convenience).public static int signedByteToUnsignedInt(byte b)
b - byte to convert to intpublic static ZipLong toDosTime(java.util.Date time)
time - the Date to convertZipLongpublic static byte[] toDosTime(long t)
Stolen from InfoZip's fileio.c
t - number of milliseconds since the epochpublic static void toDosTime(long t,
byte[] buf,
int offset)
Stolen from InfoZip's fileio.c
t - number of milliseconds since the epochbuf - the output bufferoffset - The offset within the output buffer of the first byte to be written. must be non-negative and no larger than buf.length-4public static byte unsignedIntToSignedByte(int i)
i - integer to convert to bytejava.lang.IllegalArgumentException - if the provided integer is not inside the range [0,255].Copyright © 2010 - 2024 Adobe. All Rights Reserved