|
segue um exemplo para compactar arquivos
vc tem que importar o seguinte pacote:
import java.util.zip.*;
public boolean zipFile (String nameFile)
throws Exception
{ FileInputStream file = new FileInputStream(nameFile); BufferedInputStream bis = new BufferedInputStream(file); FileOutputStream fout = new FileOutputStream(nameFile + ".ZIP"); ZipOutputStream zos = new ZipOutputStream(fout); ZipEntry ze = new
ZipEntry(nameFile);
zos.putNextEntry(ze); byte[] data = "" byte[1024]; int byteCount; while ((byteCount = bis.read(data, 0, 1024)) > -1) { zos.write(data, 0, byteCount); } zos.closeEntry(); zos.close(); return
true;
}
|
- [java-list] *** Compacta??o DENTRO DO JAVA - U... LUIZ CARLOS FILIPPI JUNIOR
- Re: [java-list] *** Compacta??o DENTRO DO ... Jose Carlos
- Re: [java-list] *** Compacta??o DENTRO DO ... Luis Sergio Faria Carneiro
