org.apache.commons.compress.archivers.zip.ZipUtil.dosToJavaTime()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中org.apache.commons.compress.archivers.zip.ZipUtil.dosToJavaTime()方法的一些代码示例,展示了ZipUtil.dosToJavaTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipUtil.dosToJavaTime()方法的具体详情如下:
包路径:org.apache.commons.compress.archivers.zip.ZipUtil
类名称:ZipUtil
方法名:dosToJavaTime

ZipUtil.dosToJavaTime介绍

[英]Converts DOS time to Java time (number of milliseconds since epoch).
[中]将DOS时间转换为Java时间(从epoch开始的毫秒数)。

代码示例

代码示例来源:origin: org.apache.commons/commons-compress

  1. /**
  2. * Convert a DOS date/time field to a Date object.
  3. *
  4. * @param zipDosTime contains the stored DOS time.
  5. * @return a Date instance corresponding to the given time.
  6. */
  7. public static Date fromDosTime(final ZipLong zipDosTime) {
  8. final long dosTime = zipDosTime.getValue();
  9. return new Date(dosToJavaTime(dosTime));
  10. }

代码示例来源:origin: org.apache.commons/commons-compress

  1. /**
  2. * The last modified date of the entry.
  3. *
  4. * <p>Note the interpretation of time is different depending on
  5. * the HostOS that has created the archive. While an OS that is
  6. * {@link #isHostOsUnix considered to be Unix} stores time in a
  7. * timezone independent manner, other platforms only use the local
  8. * time. I.e. if an archive has been created at midnight UTC on a
  9. * machine in timezone UTC this method will return midnight
  10. * regardless of timezone if the archive has been created on a
  11. * non-Unix system and a time taking the current timezone into
  12. * account if the archive has beeen created on Unix.</p>
  13. *
  14. * @return the last modified date
  15. */
  16. @Override
  17. public Date getLastModifiedDate() {
  18. final long ts = isHostOsUnix() ? localFileHeader.dateTimeModified * 1000L
  19. : ZipUtil.dosToJavaTime(0xFFFFFFFFL & localFileHeader.dateTimeModified);
  20. return new Date(ts);
  21. }

代码示例来源:origin: org.apache.commons/commons-compress

  1. off += SHORT;
  2. final long time = ZipUtil.dosToJavaTime(ZipLong.getValue(cfhBuf, off));
  3. ze.setTime(time);
  4. off += WORD;

代码示例来源:origin: org.apache.commons/commons-compress

  1. off += SHORT;
  2. final long time = ZipUtil.dosToJavaTime(ZipLong.getValue(lfhBuf, off));
  3. current.entry.setTime(time);
  4. off += WORD;

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

  1. /**
  2. * Convert a DOS date/time field to a Date object.
  3. *
  4. * @param zipDosTime contains the stored DOS time.
  5. * @return a Date instance corresponding to the given time.
  6. */
  7. public static Date fromDosTime(final ZipLong zipDosTime) {
  8. final long dosTime = zipDosTime.getValue();
  9. return new Date(dosToJavaTime(dosTime));
  10. }

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

  1. /**
  2. * The last modified date of the entry.
  3. *
  4. * <p>Note the interpretation of time is different depending on
  5. * the HostOS that has created the archive. While an OS that is
  6. * {@link #isHostOsUnix considered to be Unix} stores time in a
  7. * timezone independent manner, other platforms only use the local
  8. * time. I.e. if an archive has been created at midnight UTC on a
  9. * machine in timezone UTC this method will return midnight
  10. * regardless of timezone if the archive has been created on a
  11. * non-Unix system and a time taking the current timezone into
  12. * account if the archive has beeen created on Unix.</p>
  13. *
  14. * @return the last modified date
  15. */
  16. @Override
  17. public Date getLastModifiedDate() {
  18. final long ts = isHostOsUnix() ? localFileHeader.dateTimeModified * 1000L
  19. : ZipUtil.dosToJavaTime(0xFFFFFFFFL & localFileHeader.dateTimeModified);
  20. return new Date(ts);
  21. }

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

  1. off += SHORT;
  2. final long time = ZipUtil.dosToJavaTime(ZipLong.getValue(cfhBuf, off));
  3. ze.setTime(time);
  4. off += WORD;

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

  1. off += SHORT;
  2. final long time = ZipUtil.dosToJavaTime(ZipLong.getValue(lfhBuf, off));
  3. current.entry.setTime(time);
  4. off += WORD;

相关文章