/** * Convert a Date object to a DOS date/time field. * * <p>Stolen from InfoZip's <code>fileio.c</code></p> * @param t number of milliseconds since the epoch * @return the date as a byte array */ public static byte[] toDosTime(final long t) { final byte[] result = new byte[4]; toDosTime(t, result, 0); return result; }
/** * Convert a Date object to a DOS date/time field. * * <p>Stolen from InfoZip's <code>fileio.c</code></p> * @param t number of milliseconds since the epoch * @param buf the output buffer * @param offset * The offset within the output buffer of the first byte to be written. * must be non-negative and no larger than <tt>buf.length-4</tt> */ public static void toDosTime(final long t, final byte[] buf, final int offset) { toDosTime(Calendar.getInstance(), t, buf, offset); }
/** * Convert a Date object to a DOS date/time field. * @param time the <code>Date</code> to convert * @return the date as a <code>ZipLong</code> */ public static ZipLong toDosTime(final Date time) { return new ZipLong(toDosTime(time.getTime())); }
ZipUtil.toDosTime(calendarInstance, ze.getTime(), buf, CFH_TIME_OFFSET);
ZipUtil.toDosTime(calendarInstance, ze.getTime(), buf, LFH_TIME_OFFSET);
/** * Convert a Date object to a DOS date/time field. * * <p>Stolen from InfoZip's <code>fileio.c</code></p> * @param t number of milliseconds since the epoch * @return the date as a byte array */ public static byte[] toDosTime(final long t) { final byte[] result = new byte[4]; toDosTime(t, result, 0); return result; }
/** * Convert a Date object to a DOS date/time field. * * <p>Stolen from InfoZip's <code>fileio.c</code></p> * @param t number of milliseconds since the epoch * @param buf the output buffer * @param offset * The offset within the output buffer of the first byte to be written. * must be non-negative and no larger than <tt>buf.length-4</tt> */ public static void toDosTime(final long t, final byte[] buf, final int offset) { toDosTime(Calendar.getInstance(), t, buf, offset); }
/** * Convert a Date object to a DOS date/time field. * @param time the <code>Date</code> to convert * @return the date as a <code>ZipLong</code> */ public static ZipLong toDosTime(final Date time) { return new ZipLong(toDosTime(time.getTime())); }
ZipUtil.toDosTime(calendarInstance, ze.getTime(), buf, CFH_TIME_OFFSET);
ZipUtil.toDosTime(calendarInstance, ze.getTime(), buf, LFH_TIME_OFFSET);