In this tutorial you will see how to use Use of setComment and getComment of ZipEntry.
In this tutorial you will see how to use Use of setComment and getComment of ZipEntry.In this tutorial, we will see the use of setComment and getComment
method of ZipEntry
class. The ZipEntry
class is used show available entries in a ZIP file. The ZipEntry class is
available in java.util.zip package.
In this Example, we will get the comment of entry with the help of
getComment() method,
if there is no comment on entry it returns null. The setComment() method
set the comment
on zip file entry. The getName
method of ZipEntry class return the name of associated entry.
About ZIPEntry API:
The java.util.zip.ZipEntry class extends java.lang.Object class. It provides the following methods:
Return Type | Method | Description |
String | getComment() | The method getComment() return comment of entry if not exists the returns null. |
void | setComment(String name) | The setComment() method set comment string on entry. |
String | getName() | The method getName() returns name of the associated entry. |
import java.io.*;
|
C:\>java ZipGetComment Name of Zip entry : bharat.txt Comment on bharat.txt entry before set comment : null Name of Zip entry : bharat.txt Comment on bharat.txt entry after set comment : This file store name |