gpt4 book ai didi

aQute.lib.zip.ZipUtil.setModifiedTime()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 23:59:31 26 4
gpt4 key购买 nike

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

ZipUtil.setModifiedTime介绍

暂无

代码示例

代码示例来源:origin: biz.aQute.bnd/bndlib

private void doManifest(Set<String> done, ZipOutputStream jout) throws Exception {
  check();
  if (nomanifest)
    return;
  JarEntry ze = new JarEntry(manifestName);
  ZipUtil.setModifiedTime(ze,lastModified);
  jout.putNextEntry(ze);
  writeManifest(jout);
  jout.closeEntry();
  done.add(ze.getName());
}

代码示例来源:origin: biz.aQute.bnd/bnd

private void doManifest(Set<String> done, ZipOutputStream jout) throws Exception {
  check();
  if (nomanifest)
    return;
  JarEntry ze = new JarEntry(manifestName);
  ZipUtil.setModifiedTime(ze,lastModified);
  jout.putNextEntry(ze);
  writeManifest(jout);
  jout.closeEntry();
  done.add(ze.getName());
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

void createDirectories(Set<String> directories, ZipOutputStream zip, String name) throws IOException {
  int index = name.lastIndexOf('/');
  if (index > 0) {
    String path = name.substring(0, index);
    if (directories.contains(path))
      return;
    createDirectories(directories, zip, path);
    ZipEntry ze = new ZipEntry(path + '/');
    if (isReproducible()) {
      ze.setTime(ZIP_ENTRY_CONSTANT_TIME);
    } else {
      ZipUtil.setModifiedTime(ze, lastModified);
    }
    if (compression == Compression.STORE) {
      ze.setCrc(0L);
      ze.setSize(0);
      ze.setCompressedSize(0);
    }
    zip.putNextEntry(ze);
    zip.closeEntry();
    directories.add(path);
  }
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

void createDirectories(Set<String> directories, ZipOutputStream zip, String name) throws IOException {
  int index = name.lastIndexOf('/');
  if (index > 0) {
    String path = name.substring(0, index);
    if (directories.contains(path))
      return;
    createDirectories(directories, zip, path);
    ZipEntry ze = new ZipEntry(path + '/');
    if (isReproducible()) {
      ze.setTime(ZIP_ENTRY_CONSTANT_TIME);
    } else {
      ZipUtil.setModifiedTime(ze, lastModified);
    }
    if (compression == Compression.STORE) {
      ze.setCrc(0L);
      ze.setSize(0);
      ze.setCompressedSize(0);
    }
    zip.putNextEntry(ze);
    zip.closeEntry();
    directories.add(path);
  }
}

代码示例来源:origin: biz.aQute.bnd/bndlib

private void writeResource(ZipOutputStream jout, Set<String> directories, String path, Resource resource)
    throws Exception {
  if (resource == null)
    return;
  try {
    createDirectories(directories, jout, path);
    if (path.endsWith(Constants.EMPTY_HEADER))
      return;
    ZipEntry ze = new ZipEntry(path);
    ze.setMethod(ZipEntry.DEFLATED);
    long lastModified = resource.lastModified();
    if (lastModified == 0L) {
      lastModified = System.currentTimeMillis();
    }
    ZipUtil.setModifiedTime(ze,lastModified);
    if (resource.getExtra() != null)
      ze.setExtra(resource.getExtra().getBytes("UTF-8"));
    jout.putNextEntry(ze);
    resource.write(jout);
    jout.closeEntry();
  }
  catch (Exception e) {
    throw new Exception("Problem writing resource " + path, e);
  }
}

代码示例来源:origin: biz.aQute.bnd/bnd

private void writeResource(ZipOutputStream jout, Set<String> directories, String path, Resource resource)
    throws Exception {
  if (resource == null)
    return;
  try {
    createDirectories(directories, jout, path);
    if (path.endsWith(Constants.EMPTY_HEADER))
      return;
    ZipEntry ze = new ZipEntry(path);
    ze.setMethod(ZipEntry.DEFLATED);
    long lastModified = resource.lastModified();
    if (lastModified == 0L) {
      lastModified = System.currentTimeMillis();
    }
    ZipUtil.setModifiedTime(ze,lastModified);
    if (resource.getExtra() != null)
      ze.setExtra(resource.getExtra().getBytes("UTF-8"));
    jout.putNextEntry(ze);
    resource.write(jout);
    jout.closeEntry();
  }
  catch (Exception e) {
    throw new Exception("Problem writing resource " + path, e);
  }
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

private void doManifest(ZipOutputStream jout, Set<String> directories, String manifestName) throws Exception {
  check();
  createDirectories(directories, jout, manifestName);
  JarEntry ze = new JarEntry(manifestName);
  if (isReproducible()) {
    ze.setTime(ZIP_ENTRY_CONSTANT_TIME);
  } else {
    ZipUtil.setModifiedTime(ze, lastModified);
  }
  Resource r = new WriteResource() {
    @Override
    public void write(OutputStream out) throws Exception {
      writeManifest(out);
    }
    @Override
    public long lastModified() {
      return 0; // a manifest should not change the date
    }
  };
  putEntry(jout, ze, r);
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

private void writeResource(ZipOutputStream jout, Set<String> directories, String path, Resource resource)
  throws Exception {
  if (resource == null)
    return;
  try {
    createDirectories(directories, jout, path);
    if (path.endsWith(Constants.EMPTY_HEADER))
      return;
    ZipEntry ze = new ZipEntry(path);
    ze.setMethod(ZipEntry.DEFLATED);
    if (isReproducible()) {
      ze.setTime(ZIP_ENTRY_CONSTANT_TIME);
    } else {
      long lastModified = resource.lastModified();
      if (lastModified == 0L) {
        lastModified = System.currentTimeMillis();
      }
      ZipUtil.setModifiedTime(ze, lastModified);
    }
    if (resource.getExtra() != null)
      ze.setExtra(resource.getExtra()
        .getBytes(UTF_8));
    putEntry(jout, ze, resource);
  } catch (Exception e) {
    throw new Exception("Problem writing resource " + path, e);
  }
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

private void writeResource(ZipOutputStream jout, Set<String> directories, String path, Resource resource)
  throws Exception {
  if (resource == null)
    return;
  try {
    createDirectories(directories, jout, path);
    if (path.endsWith(Constants.EMPTY_HEADER))
      return;
    ZipEntry ze = new ZipEntry(path);
    ze.setMethod(ZipEntry.DEFLATED);
    if (isReproducible()) {
      ze.setTime(ZIP_ENTRY_CONSTANT_TIME);
    } else {
      long lastModified = resource.lastModified();
      if (lastModified == 0L) {
        lastModified = System.currentTimeMillis();
      }
      ZipUtil.setModifiedTime(ze, lastModified);
    }
    if (resource.getExtra() != null)
      ze.setExtra(resource.getExtra()
        .getBytes(UTF_8));
    putEntry(jout, ze, resource);
  } catch (Exception e) {
    throw new Exception("Problem writing resource " + path, e);
  }
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

private void doManifest(ZipOutputStream jout, Set<String> directories, String manifestName) throws Exception {
  check();
  createDirectories(directories, jout, manifestName);
  JarEntry ze = new JarEntry(manifestName);
  if (isReproducible()) {
    ze.setTime(ZIP_ENTRY_CONSTANT_TIME);
  } else {
    ZipUtil.setModifiedTime(ze, lastModified);
  }
  Resource r = new WriteResource() {
    @Override
    public void write(OutputStream out) throws Exception {
      writeManifest(out);
    }
    @Override
    public long lastModified() {
      return 0; // a manifest should not change the date
    }
  };
  putEntry(jout, ze, r);
}

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