RAR을 지퍼로 변환합니다
Contents
[
Hide
Show
]RAR 아카이브를 지퍼로 변환하려면이 기사를 읽으십시오.
전환
aspose.zip api는 rararchive 클래스를 제공하여 RAR 아카이브를 추출합니다. 중간 저장소에 저장하지 않고 메모리에 대한 항목을 추출하고 즉시 Zip Archive로 전달할 수 있습니다.
모든 항목의 내용을 유지하기에 충분한 가상 메모리가 있는지 확인하십시오.
항목 전송
다음 코드 예제는 RAR 아카이브에서 항목을 추출하여 즉시 Zip Archive에 넣는 방법을 보여줍니다. 부록 슬래시가 추가 된 디렉토리 인 항목은 자신의 종류를 지정합니다.
1try (archive zip = new Archive ()) {
2 try (rararchive rar = new rararchive ( "d : \\ archvie.rar")) {
3 for (int i = 0; i <rar.getentries (). size (); i ++) {
4 rararchiveEntry entry = rar.getentries (). get (i);
5 if (! enther.isdirectory ()) {
6 try (bytearrayoutputStream out = new BytearRayoutputStream ()) {
7 Entrystract (out);
8 try (bytearrayinputstream in = new BytearrayinputStream (out.tobytearray ())) {
9 Zip.CreateEntry (Entry.GetName (), in);
10 }
11 }
12 } 또 다른 {
13 Zip.CreateEntry (Entry.GetName () + "/", New ByTearRayInputStream (New Byte [0]);
14 }
15 }
16 }
17 zip.save ( "output.zip");
18} catch (ioException ex) {
19 System.out.println (예);
20}