This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to extract a .tar.gz file?  RSS feed

 
ram shyam
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I tried using GZIPInputStream on the file of type .tar.gz and wrote the outputstream which returned a file of type VisualPax Archive instead of a .tar type. So, I am not able to use any Runtime code to run "tar xvf" on the generated output file and untar the folder.

Please let me know how to extract the folder of type .tar.gz which contains multiple text files.

Thanks in advance!!
 
G.T. Reddy
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use WINRAR
 
ram shyam
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How do I use WINRAR in JAVA code?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used the Commons Compress library for tar processing in the past. Note that there's no binary build available; you'll need to grab the source code from the repository.
 
Rob Spoor
Sheriff
Posts: 21089
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use a library like Commons Compress or Java Tar that mimicks the behaviour of ZipInputStream et all, it's quite easy:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!