• Post Reply Bookmark Topic Watch Topic
  • New Topic

Zipping a file with java api without storing full path  RSS feed

 
Nicol�s Pad�n
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Is it possibly to zip a file with the java api without storing the full path of the file being zipped? The winrar GUI has an option to do it, I want to get the same result but inside a java app.

Thank you very much in advance...

Nicol�s
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ZipOutputStream takes an OutputStream in the constructor.
So, you can create the ZipOutputStream over a ByteArrayOutputStream and keep writing.
ByteArrayOutputStream will have the zipped data and you need not write it anywhere on the file system and hence do not need any path.

Does this answer your question?
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ZipEntry can have any name set when you create it. Play around with that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!