Results 1 to 7 of 7
- 08-06-2010, 03:35 PM #1
Help needed for "java.io.IOException: Not in GZIP format"
Hi Everyone,
I am facing some issues with GZIPInputStream. I am trying to connect a FileInputStream thru it, but some weird exception is coming my way... Posting the code below,
The tar.gz file exists at it's place, so no issue with that. When I try to run this, I get a big exception,Java Code:import java.io.FileInputStream; import java.util.zip.GZIPInputStream; public class GZipTester { public static void main(String args[]) { try { String file = "C://Testing.tar.gz"; GZIPInputStream gzip = new GZIPInputStream(new FileInputStream(file)); System.out.println("Success..."); } catch(Exception e) { e.printStackTrace(); } } }
Can someone please help me out in this? I have spent almost all my day digging into this issue. But no success.Java Code:java.io.IOException: Not in GZIP format at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:131) at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:58) at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:68) at GZipTester.main(GZipTester.java:10)
Any help would be appreciated!
Thanks much,
Goldest
- 08-06-2010, 05:09 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
How did you create that zip file, by renaming an excising? Seems to me that file format is corrupted.
- 08-06-2010, 06:27 PM #3
- 08-07-2010, 02:22 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Then no need of hang on this. I'm quit.
- 08-08-2010, 09:19 PM #5
Hi Eranga,
Thanks for your response on this.
The file that I am using is a proper tar.gz file which has been downloaded from internet. The file is working fine. By using the WinRAR or any other extracting tool, the file gets extracted correctly and even the contents can be seen properly.
There is something wrong with the "readHeader" of GZIPInputStream as shown in the stack trace. I am not sure how to resolve this.
Any help from you will be nice.
Goldest
- 08-08-2010, 10:13 PM #6
Why do you assume that the file you have is a GZIPOutput file?
Change the input to your test program to any text file and see if you get the same trace.There is something wrong with the "readHeader" of GZIPInputStream as shown in the stack trace
Rewrite your simple program to use the GZIPOutputStream to write a String out to a file and then have your current code read that same file in and display it. That will work.
Then look at the file produced and see what utilities can open it and show its contents.
- 08-10-2010, 09:22 AM #7
Solved
Thanks Norm! That's what was actually happening.
More details cross posted here
Thanks much,
Goldest
Similar Threads
-
Regular expressions checking, by the format "*,txt",ab* etc'
By liran in forum Advanced JavaReplies: 23Last Post: 04-18-2010, 09:35 PM -
Java, Military Format using "/" and "%" Operator!!
By sk8rsam77 in forum New To JavaReplies: 11Last Post: 02-26-2010, 03:03 AM -
final String currentWorld = "Java Forums"; String.format("Hello %s", currentWorld);
By mcfrog in forum IntroductionsReplies: 0Last Post: 04-02-2009, 07:02 PM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM -
Struts 1.x <bean:write format="0.00%"> help?
By prabhurangan in forum Web FrameworksReplies: 0Last Post: 07-02-2008, 12:59 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks