apache - How to add custom information into Zip archive for every ZipArchiveEntry in Java (getComment is always null) -


using: java, apache commons compress (1.10) (org.apache.commons.compress.archivers.zip.ziparchiveoutputstream) (org.apache.commons.compress.archivers.zip.ziparchiveentry)

is there way, how add custom information (byte[] or string) zip archive entry?

i tried use following methods:

entry.setextra(byte[] extra); entry.setextrafields(zipextrafield[] fields); entry.setcomment(string comment); 

but seems setextra limited 2 bytes , setextrafields takes zip standarized fields, not custom parameter.

the promissing setcomment null (decompression), no matter if , set (compression).

compression example (using setcomment):

ziparchiveoutputstream zaos = new ziparchiveoutputstream(fos); ziparchiveentry entry = new ziparchiveentry(file.getname());  entry.setcomment("test"); zaos.putarchiveentry(entry); // write data zaos.closearchiveentry(); zaos.finish(); 

on decompression entry.getcomment() null.


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -