當前位置: 首頁>>代碼示例>>Java>>正文


Java TarArchiveEntry.getDirectoryEntries方法代碼示例

本文整理匯總了Java中org.apache.commons.compress.archivers.tar.TarArchiveEntry.getDirectoryEntries方法的典型用法代碼示例。如果您正苦於以下問題:Java TarArchiveEntry.getDirectoryEntries方法的具體用法?Java TarArchiveEntry.getDirectoryEntries怎麽用?Java TarArchiveEntry.getDirectoryEntries使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.compress.archivers.tar.TarArchiveEntry的用法示例。


在下文中一共展示了TarArchiveEntry.getDirectoryEntries方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addDirectory

import org.apache.commons.compress.archivers.tar.TarArchiveEntry; //導入方法依賴的package包/類
/**
 * @deprecated see {@link PLP5ProjectParser#parse(File)}
 */
private static void addDirectory(TarArchiveInputStream plpInputStream,
		TarArchiveEntry entry, File assembleFile, List<ASMFile> projectFiles)
		throws IOException
{
	for (TarArchiveEntry subEntry : entry.getDirectoryEntries())
	{
		if (!subEntry.isDirectory())
		{
			addFile(plpInputStream, subEntry, assembleFile, projectFiles);
		}
		else
		{
			addDirectory(plpInputStream, subEntry, assembleFile, projectFiles);
		}
	}
}
 
開發者ID:dhawal9035,項目名稱:WebPLP,代碼行數:20,代碼來源:FileUtil.java

示例2: addDirectory

import org.apache.commons.compress.archivers.tar.TarArchiveEntry; //導入方法依賴的package包/類
private void addDirectory(TarArchiveEntry entry) throws IOException
{
	for (TarArchiveEntry subEntry : entry.getDirectoryEntries())
	{
		if (!subEntry.isDirectory())
		{
			addFile(subEntry);
		}
		else
		{
			addDirectory(subEntry);
		}
	}
}
 
開發者ID:dhawal9035,項目名稱:WebPLP,代碼行數:15,代碼來源:PLP5ProjectParser.java

示例3: unpackEntries

import org.apache.commons.compress.archivers.tar.TarArchiveEntry; //導入方法依賴的package包/類
private static void unpackEntries(TarArchiveInputStream tis,
    TarArchiveEntry entry, File outputDir) throws IOException {
  if (entry.isDirectory()) {
    File subDir = new File(outputDir, entry.getName());
    if (!subDir.mkdirs() && !subDir.isDirectory()) {
      throw new IOException("Mkdirs failed to create tar internal dir "
          + outputDir);
    }

    for (TarArchiveEntry e : entry.getDirectoryEntries()) {
      unpackEntries(tis, e, subDir);
    }

    return;
  }

  File outputFile = new File(outputDir, entry.getName());
  if (!outputFile.getParentFile().exists()) {
    if (!outputFile.getParentFile().mkdirs()) {
      throw new IOException("Mkdirs failed to create tar internal dir "
          + outputDir);
    }
  }

  int count;
  byte data[] = new byte[2048];
  BufferedOutputStream outputStream = new BufferedOutputStream(
      new FileOutputStream(outputFile));

  while ((count = tis.read(data)) != -1) {
    outputStream.write(data, 0, count);
  }

  outputStream.flush();
  outputStream.close();
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:37,代碼來源:FileUtil.java

示例4: unpackEntries

import org.apache.commons.compress.archivers.tar.TarArchiveEntry; //導入方法依賴的package包/類
private static void unpackEntries(TarArchiveInputStream tis,
    TarArchiveEntry entry, File outputDir) throws IOException {
  if (entry.isDirectory()) {
    File subDir = new File(outputDir, entry.getName());
    if (!subDir.mkdir() && !subDir.isDirectory()) {
      throw new IOException("Mkdirs failed to create tar internal dir "
          + outputDir);
    }

    for (TarArchiveEntry e : entry.getDirectoryEntries()) {
      unpackEntries(tis, e, subDir);
    }

    return;
  }

  File outputFile = new File(outputDir, entry.getName());
  if (!outputDir.exists()) {
    if (!outputDir.mkdirs()) {
      throw new IOException("Mkdirs failed to create tar internal dir "
          + outputDir);
    }
  }

  int count;
  byte data[] = new byte[2048];
  BufferedOutputStream outputStream = new BufferedOutputStream(
      new FileOutputStream(outputFile));

  while ((count = tis.read(data)) != -1) {
    outputStream.write(data, 0, count);
  }

  outputStream.flush();
  outputStream.close();
}
 
開發者ID:ict-carch,項目名稱:hadoop-plus,代碼行數:37,代碼來源:FileUtil.java

示例5: unpackEntries

import org.apache.commons.compress.archivers.tar.TarArchiveEntry; //導入方法依賴的package包/類
private static void unpackEntries(TarArchiveInputStream tis,
                                  TarArchiveEntry entry, File outputDir) throws IOException {
    if (entry.isDirectory()) {
        File subDir = new File(outputDir, entry.getName());
        if (!subDir.mkdirs() && !subDir.isDirectory()) {
            throw new IOException("Mkdirs failed to create tar internal dir "
                    + outputDir);
        }
        for (TarArchiveEntry e : entry.getDirectoryEntries()) {
            unpackEntries(tis, e, subDir);
        }
        return;
    }
    File outputFile = new File(outputDir, entry.getName());
    if (!outputFile.getParentFile().exists()) {
        if (!outputFile.getParentFile().mkdirs()) {
            throw new IOException("Mkdirs failed to create tar internal dir "
                    + outputDir);
        }
    }
    int count;
    byte data[] = new byte[2048];
    BufferedOutputStream outputStream = new BufferedOutputStream(
            new FileOutputStream(outputFile));

    while ((count = tis.read(data)) != -1) {
        outputStream.write(data, 0, count);
    }
    outputStream.flush();
    outputStream.close();
}
 
開發者ID:alibaba,項目名稱:jstorm,代碼行數:32,代碼來源:Utils.java

示例6: unpackEntries

import org.apache.commons.compress.archivers.tar.TarArchiveEntry; //導入方法依賴的package包/類
private static void unpackEntries(TarArchiveInputStream tis,
    TarArchiveEntry entry, File outputDir) throws IOException {
  if (entry.isDirectory()) {
    File subDir = new File(outputDir, entry.getName());
    if (!subDir.mkdirs() && !subDir.isDirectory()) {
      throw new IOException("Mkdirs failed to create tar internal dir "
          + outputDir);
    }

    for (TarArchiveEntry e : entry.getDirectoryEntries()) {
      unpackEntries(tis, e, subDir);
    }

    return;
  }

  File outputFile = new File(outputDir, entry.getName());
  if (!outputFile.getParentFile().exists()) {
    if (!outputFile.getParentFile().mkdirs()) {
      throw new IOException("Mkdirs failed to create tar internal dir "
          + outputDir);
    }
  }

  if (entry.isLink()) {
    File src = new File(outputDir, entry.getLinkName());
    HardLink.createHardLink(src, outputFile);
    return;
  }

  int count;
  byte data[] = new byte[2048];
  try (BufferedOutputStream outputStream = new BufferedOutputStream(
      new FileOutputStream(outputFile));) {

    while ((count = tis.read(data)) != -1) {
      outputStream.write(data, 0, count);
    }

    outputStream.flush();
  }
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:43,代碼來源:FileUtil.java


注:本文中的org.apache.commons.compress.archivers.tar.TarArchiveEntry.getDirectoryEntries方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。