gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-17 09:32:40 29 4
gpt4 key购买 nike

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

ZipArchiveEntry.setTime介绍

暂无

代码示例

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

/**
 * Creates a new zip entry taking some information from the given
 * file and using the provided name.
 *
 * <p>The name will be adjusted to end with a forward slash "/" if
 * the file is a directory.  If the file is not a directory a
 * potential trailing forward slash will be stripped from the
 * entry name.</p>
 * @param inputFile file to create the entry from
 * @param entryName name of the entry
 */
public ZipArchiveEntry(final File inputFile, final String entryName) {
  this(inputFile.isDirectory() && !entryName.endsWith("/") ?
     entryName + "/" : entryName);
  if (inputFile.isFile()){
    setSize(inputFile.length());
  }
  setTime(inputFile.lastModified());
  // TODO are there any other fields we can set here?
}

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

/**
 * Provides default values for compression method and last
 * modification time.
 */
private void setDefaults(final ZipArchiveEntry entry) {
  if (entry.getMethod() == -1) { // not specified
    entry.setMethod(method);
  }
  if (entry.getTime() == -1) { // not specified
    entry.setTime(System.currentTimeMillis());
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

zeNew.setComment(ze.getComment());
zeNew.setExtra(ze.getExtra());
zeNew.setTime(ze.getTime());

代码示例来源:origin: org.apache.poi/poi-ooxml

ZipArchiveEntry zeOut = new ZipArchiveEntry(ze.getName());
zeOut.setSize(ze.getSize());
zeOut.setTime(ze.getTime());
zos.putArchiveEntry(zeOut);
try (final InputStream is = zipEntrySource.getInputStream(ze)) {

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

current.entry.setTime(time);
off += WORD;

代码示例来源:origin: io.takari/takari-archiver

@Override
public void setTime(long time) {
 super.setTime(time);
}

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

/**
 * Creates a new zip entry taking some information from the given
 * file and using the provided name.
 *
 * <p>The name will be adjusted to end with a forward slash "/" if
 * the file is a directory.  If the file is not a directory a
 * potential trailing forward slash will be stripped from the
 * entry name.</p>
 * @param inputFile file to create the entry from
 * @param entryName name of the entry
 */
public ZipArchiveEntry(final File inputFile, final String entryName) {
  this(inputFile.isDirectory() && !entryName.endsWith("/") ?
     entryName + "/" : entryName);
  if (inputFile.isFile()){
    setSize(inputFile.length());
  }
  setTime(inputFile.lastModified());
  // TODO are there any other fields we can set here?
}

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

/**
 * Provides default values for compression method and last
 * modification time.
 */
private void setDefaults(final ZipArchiveEntry entry) {
  if (entry.getMethod() == -1) { // not specified
    entry.setMethod(method);
  }
  if (entry.getTime() == -1) { // not specified
    entry.setTime(System.currentTimeMillis());
  }
}

代码示例来源:origin: com.comcast.pantry/pantry

archiveEntry.setTime(tempNode.lastModified());
zip.putArchiveEntry(archiveEntry);
zip.closeArchiveEntry();

代码示例来源:origin: com.comcast.pantry/pantry

archiveEntry.setTime(node.lastModified());
  zip.putArchiveEntry(archiveEntry);
  zip.closeArchiveEntry();
archiveEntry.setTime(node.lastModified());
zip.putArchiveEntry(archiveEntry);

代码示例来源:origin: ZuInnoTe/hadoopoffice

zeNew.setComment(ze.getComment());
zeNew.setExtra(ze.getExtra());
zeNew.setTime(ze.getTime());
zos.putArchiveEntry(zeNew);
FilterOutputStream fos2 = new FilterOutputStream(zos) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

zeNew.setComment(ze.getComment());
zeNew.setExtra(ze.getExtra());
zeNew.setTime(ze.getTime());

代码示例来源:origin: org.jetbrains.xodus/xodus-compress

final ZipArchiveEntry entry = new ZipArchiveEntry(source.getPath() + source.getName());
  entry.setSize(fileSize);
  entry.setTime(source.getTimeStamp());
  out.putArchiveEntry(entry);
} else {

代码示例来源:origin: Zlika/reproducible-build-maven-plugin

private ZipArchiveEntry filterZipEntry(ZipArchiveEntry entry)
  {
    // Set times
    entry.setCreationTime(FileTime.fromMillis(zipTimestamp));
    entry.setLastAccessTime(FileTime.fromMillis(zipTimestamp));
    entry.setLastModifiedTime(FileTime.fromMillis(zipTimestamp));
    entry.setTime(zipTimestamp);
    // Remove extended timestamps
    for (ZipExtraField field : entry.getExtraFields())
    {
      if (field instanceof X5455_ExtendedTimestamp)
      {
        entry.removeExtraField(field.getHeaderId());
      }
    }
    return entry;
  }
}

代码示例来源:origin: de.unkrig/de-unkrig-commons

@Override public void
writeEntry(
  ArchiveOutputStream                                              archiveOutputStream,
  ArchiveEntry                                                     archiveEntry,
  @Nullable String                                                 name,
  ConsumerWhichThrows<? super OutputStream, ? extends IOException> writeContents
) throws IOException {
  if (!(archiveOutputStream instanceof ZipArchiveOutputStream)) {
    throw new IllegalArgumentException(archiveOutputStream.getClass().getName());
  }
  ZipArchiveEntry nzae = new ZipArchiveEntry(name != null ? name : archiveEntry.getName());
  nzae.setTime(archiveEntry.getLastModifiedDate().getTime());
  if (archiveEntry instanceof ZipArchiveEntry) {
    ZipArchiveEntry zae  = (ZipArchiveEntry) archiveEntry;
    nzae.setComment(zae.getComment());
    nzae.setExternalAttributes(zae.getExternalAttributes());
    nzae.setExtraFields(zae.getExtraFields(true));
    nzae.setGeneralPurposeBit(zae.getGeneralPurposeBit());
    nzae.setInternalAttributes(zae.getInternalAttributes());
    nzae.setMethod(zae.getMethod());
    if (nzae.isDirectory()) {
      nzae.setSize(0);
      nzae.setCrc(0);
    }
  }
  archiveOutputStream.putArchiveEntry(nzae);
  if (!archiveEntry.isDirectory()) writeContents.consume(archiveOutputStream);
  archiveOutputStream.closeArchiveEntry();
}

代码示例来源:origin: de.unkrig.commons/commons-file

@Override public void
writeEntry(
  ArchiveOutputStream                                              archiveOutputStream,
  ArchiveEntry                                                     archiveEntry,
  @Nullable String                                                 name,
  ConsumerWhichThrows<? super OutputStream, ? extends IOException> writeContents
) throws IOException {
  if (!(archiveOutputStream instanceof ZipArchiveOutputStream)) {
    throw new IllegalArgumentException(archiveOutputStream.getClass().getName());
  }
  ZipArchiveEntry nzae = new ZipArchiveEntry(name != null ? name : archiveEntry.getName());
  nzae.setTime(archiveEntry.getLastModifiedDate().getTime());
  if (archiveEntry instanceof ZipArchiveEntry) {
    ZipArchiveEntry zae  = (ZipArchiveEntry) archiveEntry;
    nzae.setComment(zae.getComment());
    nzae.setExternalAttributes(zae.getExternalAttributes());
    nzae.setExtraFields(zae.getExtraFields(true));
    nzae.setGeneralPurposeBit(zae.getGeneralPurposeBit());
    nzae.setInternalAttributes(zae.getInternalAttributes());
    nzae.setMethod(zae.getMethod());
    if (nzae.isDirectory()) {
      nzae.setSize(0);
      nzae.setCrc(0);
    }
  }
  archiveOutputStream.putArchiveEntry(nzae);
  if (!archiveEntry.isDirectory()) writeContents.consume(archiveOutputStream);
  archiveOutputStream.closeArchiveEntry();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

ZipArchiveEntry zeOut = new ZipArchiveEntry(ze.getName());
zeOut.setSize(ze.getSize());
zeOut.setTime(ze.getTime());
zos.putArchiveEntry(zeOut);
try (final InputStream is = zipEntrySource.getInputStream(ze)) {

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

@Override
  public ArchiveEntry buildEntry(ArchiveBase.ResourceWithFlags r) {
    boolean isDir = r.getResource().isDirectory();
    ZipArchiveEntry ent = new ZipArchiveEntry(r.getName());
    ent.setTime(round(r.getResource().getLastModified(), 2000));
    ent.setSize(isDir ? 0 : r.getResource().getSize());
    if (!isDir && r.getCollectionFlags().hasModeBeenSet()) {
      ent.setUnixMode(r.getCollectionFlags().getMode());
    } else if (isDir
          && r.getCollectionFlags().hasDirModeBeenSet()) {
      ent.setUnixMode(r.getCollectionFlags().getDirMode());
    } else if (r.getResourceFlags().hasModeBeenSet()) {
      ent.setUnixMode(r.getResourceFlags().getMode());
    } else {
      ent.setUnixMode(isDir
              ? ArchiveFileSet.DEFAULT_DIR_MODE
              : ArchiveFileSet.DEFAULT_FILE_MODE);
    }
    if (r.getResourceFlags().getZipExtraFields() != null) {
      ent.setExtraFields(r.getResourceFlags()
                .getZipExtraFields());
    }
    if (keepCompression
      && r.getResourceFlags().hasCompressionMethod()) {
      ent.setMethod(r.getResourceFlags()
             .getCompressionMethod());
    }
    return ent;
  }
});

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

current.entry.setTime(time);
off += WORD;

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com