Package org.apache.tools.zip
Class ZipUtil
java.lang.Object
org.apache.tools.zip.ZipUtil
Utility class for handling DOS and Java time conversions.
- Since:
- Ant 1.8.1
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic longadjustToLong(int i) Assumes a negative integer really is a positive integer that has wrapped around and re-creates the original value.static longdosToJavaTime(long dosTime) Converts DOS time to Java time (number of milliseconds since epoch).static DatefromDosTime(ZipLong zipDosTime) Convert a DOS date/time field to a Date object.static byte[]toDosTime(long t) Convert a Date object to a DOS date/time field.static voidtoDosTime(long t, byte[] buf, int offset) Convert a Date object to a DOS date/time field.static ZipLongConvert a Date object to a DOS date/time field.
- 
Constructor Details- 
ZipUtilpublic ZipUtil()
 
- 
- 
Method Details- 
toDosTimeConvert a Date object to a DOS date/time field.- Parameters:
- time- the- Dateto convert
- Returns:
- the date as a ZipLong
 
- 
toDosTimepublic static byte[] toDosTime(long t) Convert a Date object to a DOS date/time field.Stolen from InfoZip's fileio.c- Parameters:
- t- number of milliseconds since the epoch
- Returns:
- the date as a byte array
 
- 
toDosTimepublic static void toDosTime(long t, byte[] buf, int offset) Convert a Date object to a DOS date/time field.Stolen from InfoZip's fileio.c- Parameters:
- t- number of milliseconds since the epoch
- buf- the output buffer
- offset- The offset within the output buffer of the first byte to be written. must be non-negative and no larger than- buf.length-4
 
- 
adjustToLongpublic static long adjustToLong(int i) Assumes a negative integer really is a positive integer that has wrapped around and re-creates the original value.This methods is no longer used as of Apache Ant 1.9.0 - Parameters:
- i- the value to treat as unsigned int.
- Returns:
- the unsigned int as a long.
 
- 
fromDosTimeConvert a DOS date/time field to a Date object.- Parameters:
- zipDosTime- contains the stored DOS time.
- Returns:
- a Date instance corresponding to the given time.
 
- 
dosToJavaTimepublic static long dosToJavaTime(long dosTime) Converts DOS time to Java time (number of milliseconds since epoch).- Parameters:
- dosTime- long
- Returns:
- long
 
 
-