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)
Convert a DOS date/time field to a Date object.
|
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)
Convert a Date object to a DOS date/time field.
|
static byte[] |
toDosTime(long t)
Convert a Date object to a DOS date/time field.
|
static void |
toDosTime(long t,
byte[] buf,
int offset)
Convert 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 ZipLong toDosTime(java.util.Date time)
time
- the Date
to convertZipLong
public 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 long adjustToLong(int i)
i
- the value to treat as unsigned int.public 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 byte unsignedIntToSignedByte(int i)
i
- integer to convert to bytejava.lang.IllegalArgumentException
- if the provided integer is not inside the range [0,255].public static java.util.Date fromDosTime(ZipLong zipDosTime)
zipDosTime
- contains the stored DOS time.public static long dosToJavaTime(long dosTime)
dosTime
- time to convertCopyright © 2010 - 2020 Adobe. All Rights Reserved