In this tutorial you will see the use of setCrc, setSize and getCrc method of ZipEntry class.
In this tutorial you will see the use of setCrc, setSize and getCrc method of ZipEntry class.In this tutorial, We will discuss the use of setCrc, setSize and
getCrc method of ZipEntry class.The
ZipEntry class is used
to show the single entry of ZIP file. The ZipEntery class provides methods
for retrieving information related to entry. The ZipEntry class is
available in java.util.zip package.
In
this example, we will set the size and set CRC( Cyclic Redundancy Check ) of
entry. The
setCrc method of ZipEntry
class set crc_32 checksum of uncompressed entry data, and the getCrc
method of ZipEntry
class returns crc_32 checksum of uncompressed entry data. The setSize method
set the uncompressed size of this entry. The getSize method of ZipEntry
class returns uncompressed
size of entry data.
About ZIPEntry API:
The java.util.zip.ZIPEntry class extends java.io.FilterIntputStream class. It provides the following methods:
Return Type | Method | Description |
void | setCrc() | The setCrc() method set CRC-32 checksum of uncompressed associated entry data. |
void | setSize() | The setSize() method set the size of uncompressed associated entry data. |
long | getCrc() | The getCrc() method returns crc_32 checksum of uncompressed associated entry data. |
long | getSize() | The getSize() method uncompressed size of associated entry data. |
import java.io.*;
|
C:\>java ZipEntrySetCrc Size of entry after setSize method : 1024 Value of crc after setCRC method : 2785745967 File successfully compressed |
Download this code