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

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

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

ZipUtil.getModifiedTime介绍

暂无

代码示例

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

@Override
public long lastModified() {
  if (lastModified != -11L) {
    return lastModified;
  }
  return lastModified = ZipUtil.getModifiedTime(entry);
}

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

@Override
public long lastModified() {
  if (lastModified != -11L) {
    return lastModified;
  }
  return lastModified = ZipUtil.getModifiedTime(entry);
}

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

public long lastModified() {
  try {
    if (lastModified == -11L) {
      lastModified = ZipUtil.getModifiedTime(entry);
    }
    return lastModified;
  }
  catch (IOException e) {
    return lastModified = -1;
  }
}

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

public long lastModified() {
  try {
    if (lastModified == -11L) {
      lastModified = ZipUtil.getModifiedTime(entry);
    }
    return lastModified;
  }
  catch (IOException e) {
    return lastModified = -1;
  }
}

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

void unzip(InputStream in, File dir) throws Exception {
    try {
      JarInputStream jin = new JarInputStream(in);
      JarEntry jentry = jin.getNextJarEntry();
      while (jentry != null) {
        if (!jentry.isDirectory()) {
          File dest = Processor.getFile(dir, jentry.getName());
          long modifiedTime = ZipUtil.getModifiedTime(jentry);
          if (!dest.isFile() || dest.lastModified() < modifiedTime || modifiedTime <= 0) {
            File dp = dest.getParentFile();
            if (!dp.exists() && !dp.mkdirs()) {
              throw new IOException("Could not create directory " + dp);
            }
            FileOutputStream out = new FileOutputStream(dest);
            try {
              copy(jin, out);
            }
            finally {
              out.close();
            }
          }
        }
        jentry = jin.getNextJarEntry();
      }
    }
    finally {
      in.close();
    }
  }
}

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

void unzip(InputStream in, File dir) throws Exception {
    try {
      JarInputStream jin = new JarInputStream(in);
      JarEntry jentry = jin.getNextJarEntry();
      while (jentry != null) {
        if (!jentry.isDirectory()) {
          File dest = Processor.getFile(dir, jentry.getName());
          long modifiedTime = ZipUtil.getModifiedTime(jentry);
          if (!dest.isFile() || dest.lastModified() < modifiedTime || modifiedTime <= 0) {
            File dp = dest.getParentFile();
            if (!dp.exists() && !dp.mkdirs()) {
              throw new IOException("Could not create directory " + dp);
            }
            FileOutputStream out = new FileOutputStream(dest);
            try {
              copy(jin, out);
            }
            finally {
              out.close();
            }
          }
        }
        jentry = jin.getNextJarEntry();
      }
    }
    finally {
      in.close();
    }
  }
}

相关文章