<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://ebasso.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Java%3A_PKZip_Compression</id>
	<title>Java: PKZip Compression - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://ebasso.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Java%3A_PKZip_Compression"/>
	<link rel="alternate" type="text/html" href="https://ebasso.net/wiki/index.php?title=Java:_PKZip_Compression&amp;action=history"/>
	<updated>2026-06-02T12:48:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://ebasso.net/wiki/index.php?title=Java:_PKZip_Compression&amp;diff=7817&amp;oldid=prev</id>
		<title>Ebasso: Criou a página com &quot;Compressing a file using PKZip format  = Código / Code =   import java.io.*;  import java.util.zip.*;    public class PKZIPCompress {      public static void main(String[]...&quot;</title>
		<link rel="alternate" type="text/html" href="https://ebasso.net/wiki/index.php?title=Java:_PKZip_Compression&amp;diff=7817&amp;oldid=prev"/>
		<updated>2023-02-10T19:15:31Z</updated>

		<summary type="html">&lt;p&gt;Criou a página com &amp;quot;Compressing a file using PKZip format  = Código / Code =   import java.io.*;  import java.util.zip.*;    public class PKZIPCompress {      public static void main(String[]...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Compressing a file using PKZip format&lt;br /&gt;
&lt;br /&gt;
= Código / Code =&lt;br /&gt;
&lt;br /&gt;
 import java.io.*;&lt;br /&gt;
 import java.util.zip.*;&lt;br /&gt;
 &lt;br /&gt;
 public class PKZIPCompress {&lt;br /&gt;
     public static void main(String[] args) {&lt;br /&gt;
         try {&lt;br /&gt;
             // The name of the file to be compressed&lt;br /&gt;
             String fileName = &amp;quot;example.txt&amp;quot;;&lt;br /&gt;
             &lt;br /&gt;
             FileInputStream fis = new FileInputStream(fileName); // Create a file input stream            &lt;br /&gt;
             FileOutputStream fos = new FileOutputStream(&amp;quot;example.zip&amp;quot;); // Create a file output stream&lt;br /&gt;
             &lt;br /&gt;
             ZipOutputStream zos = new ZipOutputStream(fos); // Create a ZipOutputStream&lt;br /&gt;
             ZipEntry zipEntry = new ZipEntry(fileName); // Create a new zip entry&lt;br /&gt;
             &lt;br /&gt;
             zos.putNextEntry(zipEntry);  // Put the zip entry into the ZipOutputStream&lt;br /&gt;
             &lt;br /&gt;
             byte[] buffer = new byte[1024]; // Create a buffer for reading the files&lt;br /&gt;
             &lt;br /&gt;
             // Read the file and write it to the ZipOutputStream&lt;br /&gt;
             int length;&lt;br /&gt;
             while ((length = fis.read(buffer)) &amp;gt; 0) {&lt;br /&gt;
                 zos.write(buffer, 0, length);&lt;br /&gt;
             }&lt;br /&gt;
             &lt;br /&gt;
             fis.close(); // Close the input stream&lt;br /&gt;
             zos.closeEntry(); // Close the zip entry&lt;br /&gt;
             zos.close(); // Close the ZipOutputStream&lt;br /&gt;
             &lt;br /&gt;
             System.out.println(fileName + &amp;quot; was successfully compressed to example.zip&amp;quot;);&lt;br /&gt;
         } catch (IOException e) {&lt;br /&gt;
             e.printStackTrace();&lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
= Ver também =&lt;br /&gt;
&lt;br /&gt;
* [[Java| Mais Artigos sobre Java]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Java]]&lt;/div&gt;</summary>
		<author><name>Ebasso</name></author>
	</entry>
</feed>