コード例 #1
0
ファイル: TarTest.java プロジェクト: herochao/POL-POM-5
  @Test
  public void testUncompress_withSymbolicLinks() throws IOException, ArchiveException {
    final File inputFile = new File(inputUrl.getPath(), "tarLink.tar.gz");
    final File temporaryDirectory = Files.createTempDir();

    temporaryDirectory.deleteOnExit();

    final List<File> extractedFiles = new Extractor().uncompress(inputFile, temporaryDirectory);

    final File file1 = new File(temporaryDirectory, "file1.txt");
    final File file2 = new File(temporaryDirectory, "file1_link.txt");

    assertTrue(file1.exists());
    assertTrue(file2.exists());

    assertEquals("file1content", new String(FileUtils.readFileToByteArray(file1)));
    assertEquals("file1content", new String(FileUtils.readFileToByteArray(file2)));

    assertTrue(java.nio.file.Files.isSymbolicLink(Paths.get(file2.getPath())));
  }
コード例 #2
0
 protected void processFile(File f) {
   System.out.println("#### find: " + f.getPath());
 }