org.apache.tools.zip.ZipEntry.isDirectory()方法的使用及代码示例

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

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

ZipEntry.isDirectory介绍

[英]Is this entry a directory?
[中]这个条目是目录吗?

代码示例

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

/**
 * Sets Unix permissions in a way that is understood by Info-Zip's
 * unzip command.
 *
 * @param mode an <code>int</code> value
 * @since Ant 1.5.2
 */
public void setUnixMode(final int mode) {
  // CheckStyle:MagicNumberCheck OFF - no point
  setExternalAttributes((mode << SHORT_SHIFT)
             // MS-DOS read-only attribute
             | ((mode & 0200) == 0 ? 1 : 0)
             // MS-DOS directory flag
             | (isDirectory() ? 0x10 : 0));
  // CheckStyle:MagicNumberCheck ON
  platform = PLATFORM_UNIX;
}

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

StreamUtils.enumerationAsStream(zf.getEntries()).forEach(ze -> {
  String name = ze.getName();
  if (ze.isDirectory()) {
    dirSet.add(name);
  } else if (!name.contains("/")) {

代码示例来源:origin: jenkinsci/jenkins

"Zip " + zipFile.getPath() + " contains illegal file name that breaks out of the target directory: " + e.getName());
if (e.isDirectory()) {
  mkdirs(f);
} else {

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

Resource r = new ZipResource(srcFile, encoding, entry);
String name = entry.getName();
if (entry.isDirectory()) {
  name = trimSeparator(name);
  dirEntries.put(name, r);

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

ze.isDirectory(), mapper);
} finally {
  FileUtils.close(is);

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

private void setEntry(ZipEntry e) {
  if (e == null) {
    setExists(false);
    return;
  }
  setName(e.getName());
  setExists(true);
  setLastModified(e.getTime());
  setDirectory(e.isDirectory());
  setSize(e.getSize());
  setMode(e.getUnixMode());
  extras = e.getExtraFields(true);
  method = e.getMethod();
}

代码示例来源:origin: sanluan/PublicCMS

filePath = filePath.replace("..", Constants.BLANK);
if (zipEntry.isDirectory()) {
  File dir = new File(targetPath + File.separator + filePath);
  dir.mkdirs();

代码示例来源:origin: sanluan/PublicCMS

filePath = filePath.replace("..", Constants.BLANK);
if (zipEntry.isDirectory()) {
  File dir = new File(targetPath + File.separator + filePath);
  dir.mkdirs();

代码示例来源:origin: org.gradle/gradle-core

public boolean isDirectory() {
  return entry.isDirectory();
}

代码示例来源:origin: org.kantega.openaksess/openaksess-core

private boolean isValidEntry(ZipEntry entry) {
  return !entry.isDirectory() && !entry.getName().startsWith("__MACOSX");
}

代码示例来源:origin: org.gradle/gradle-core

public RelativePath getRelativePath() {
  return new RelativePath(!entry.isDirectory(), entry.getName().split("/"));
}

代码示例来源:origin: com.github.javahaohao/utils

InputStream inputStream;
FileOutputStream fileOut;
if (entry.isDirectory())
  destFile.mkdirs();
else // 是文件

代码示例来源:origin: qq53182347/liugh-parent

while (e.hasMoreElements()) {
  ZipEntry zipEnt = (ZipEntry) e.nextElement();
  if (zipEnt.isDirectory()) {
    return false;

代码示例来源:origin: GaoFeiGit/xutils

file = new File(target + entry.getName());
if (entry.isDirectory()) {
  file.mkdirs();
} else {

代码示例来源:origin: com.github.javahaohao/utils

+ zipEntry.getName());
if (zipEntry.isDirectory()) {// 是目录,则创建之
  file.mkdirs();
} else {// 是文件

代码示例来源:origin: com.github.tianjing/tgtools.core

String entryName = ze2.getName();
String path = decompressDir + "/" + entryName;
if (ze2.isDirectory()) {
  System.out.println("正在创建解压目录 - " + entryName);
  File decompressDirFile = new File(path);

代码示例来源:origin: GaoFeiGit/xutils

if (entry.isDirectory()) {
  file.mkdirs();
} else {

代码示例来源:origin: org.gradle/gradle-core

while (!stopFlag.get() && sortedEntries.hasNext()) {
  ZipEntry entry = sortedEntries.next();
  if (entry.isDirectory()) {
    visitor.visitDir(new DetailsImpl(zipFile, expandedDir, entry, zip, stopFlag, chmod));
  } else {

代码示例来源:origin: net.wasdev.wlp.ant/wlp-anttasks

private static void unzipToDirectory(ZipFile zipFile, File destDir) throws IOException {
  byte[] buffer = new byte[4096];
  Enumeration entries = zipFile.getEntries();
  while (entries.hasMoreElements()) {
    ZipEntry entry = (ZipEntry) entries.nextElement();
    if (entry.isDirectory()) {
      File dir = new File(destDir, entry.getName());
      InstallUtils.createDirectory(dir);
    } else {
      File file = new File(destDir, entry.getName());
      InstallUtils.createDirectory(file.getParentFile());
      OutputStream out = null;
      InputStream in = null;
      try {
        out = new BufferedOutputStream(new FileOutputStream(file));
        in = zipFile.getInputStream(entry);
        Unzip.copy(in, out, buffer);
      } finally {
        InstallUtils.close(in);
        InstallUtils.close(out);
      }
      Unzip.setFilePermissions(file, entry);
    }
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

ZipEntry e = entries.nextElement();
File f = new File(dir, e.getName());
if (e.isDirectory()) {
  mkdirs(f);
} else {

相关文章