타르 아카이빙 사용 방법

타르 목적

TAR Archive 여러 파일을 단일 파일로 결합 할 수 있습니다. 공동 파일도 압축 할 수 있습니다.

압축없이 수집

TAR 아카이브에 두 파일을 수집하는 샘플이 있습니다.

 1try (fileoutputStream tarfile =  FileOutputStream ( "conter.tar")) {
 2    파일 fi1 =  파일 ( "text.txt");
 3    fi2 =  파일 ( "picture.png");
 4
 5    try (TarArchive archive = new TarArchive()) {
 6        archive.createEntry("text.txt", fi1);
 7        archive.createEntry("picture.png", fi2);
 8        archive.save(tarFile);
 9    }
10} catch (ioException ex) {
11    System.out.println (예);
12}

압축 타르 아카이브

UNIX와 같은 운영 체제Tar 유틸리티에서는 Tar Archive를 생성시 GZIP로 압축 할 수 있습니다. ASSPER.zip은 SaveGzipped 메소드와 유사한 기능을 제공합니다.

1try (tararchive archive = new tararchive ()) {
2    archive.createentry ( "text.txt", "d : \\ texts \\ article.txt");
3    archive.createentry ( "picture.png", "d : \\ picture \\ photo.png");
4    archive.savegzipped ( "result.tar.gz");
5}

오늘날 XZ Utility는 Linux와 Unix에서 인기를 얻었습니다. TAR의 압축은 Aspose.zip에 완벽하게 통합됩니다. TAR 아카이브의 SavexzCompressed 방법을 사용하십시오.

1try (tararchive archive = new tararchive ()) {
2    archive.createentry ( "text.txt", "d : \\ texts \\ article.txt");
3    archive.createentry ( "picture.png", "d : \\ picture \\ photo.png");
4    archive.savexzcompressed ( "result.tar.xz");
5}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.