이 기사의 예는 Zip 압축 파일을 작성하는 Java의 방법을 설명합니다. 참조를 위해 모든 사람을 위해 공유하십시오. 세부 사항은 다음과 같습니다.
참고 : org.apache.tools.zip을 사용하는 것이 좋습니다.
/*** 압축 된 폴더* @param sourcedir 폴더 이름 (경로 포함)* @param targetzipfile zip 파일 이름을 생성* @author liuxiangwei*/public static voidir (String sourc edir, String targetzipfile) {fileoutputStream = new FileOutputStream targetzipfile); 새로운 불법 행사+"Directory+"FileInputStream = BufferedInputStream = New BufferedInputStream (File [i]); y); (ioexception e) {새로운 msgexception ( "");이 기사는 모든 사람의 Java 프로그램 설계에 도움이되기를 바랍니다.