• Post Reply Bookmark Topic Watch Topic
  • New Topic

zipEntry.getComment() returns null  RSS feed

 
Yehor Mikhaylov
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All.
I have some troubles with zip files.
When I compressing some files I add comment to each ZipEntry:
ZipEntry zipEntry = new ZipEntry(files[i]);
zipEntry.setComment("Comment fo " + files[i]);
zos.putNextEntry(zipEntry);
But when I read archive back,
zipEntry.getComment()
returns null.
I want to write some information about files format in comments, to parse files after extraction.
Please help me.

 
Yehor Mikhaylov
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
soliloquize.
I have found solution.
setComment() and getComment() don't work.
But there are methods that can do their work:
public void setExtra(byte[] extra)
public byte[] getExtra()
All u need is to convert your string into byte array and then byte array into string.
 
Tran Trong
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can try
zipEntry = (new ZipFile(arcName)).getEntry(zipEntry.getName);

zipEntry.getComment(); // it's work for me

Have fun!!
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!