Bzip2 보관 파일을 만들어야합니다. A는 'Apache ant'에서 bzip2 라이브러리를 다운로드했습니다. Java : Bzip2 라이브러리
I use class CBZip2OutputStream:
String s = .....
CBZip2OutputStream os = new CBZip2OutputStream(fos);
os.write(s.getBytes(Charset.forName("UTF-8")));
os.flush();
os.close();
는
(나는 그것을 사용하는 방법을 어떤 예를 찾을 수 없었기 때문에이 방법을 사용하기로 결정) 그러나 디스크의 손상된 압축 파일을 생성합니다.
//Write 'BZ' before compressing the stream
fos.write("BZ".getBytes());
//Write to compressed stream as usual
CBZip2OutputStream os = new CBZip2OutputStream(fos);
... the rest ...
다음, 예를 들어, 당신이 cat compressed.bz2 | bunzip2 > uncompressed.txt
에와 bzip으로 압축 된 파일의 내용을 추출 할 수 있습니다 : 콘텐츠를 쓰기 전에 :
: https://svn.apache.org/ viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BZip2Resource.java? view = 마크 업 # l71 –