I have a url of a gzipped file. I would like to obtain an InputStream of the actual file in Java. What is the best way to achieve this?
Asked
Active
Viewed 1,106 times
1 Answers
8
Do you mean, something like GZIPInputStream?
InputStream is = ....
InputStream gis = new GZIPInputStream(is);

Dirk
- 30,623
- 8
- 82
- 102

Peter Lawrey
- 525,659
- 79
- 751
- 1,130
-
yes, I guess i did. I was assuming I needed to perform operations on the GZIPInputStream object. Sometimes the simplest solution is the hardest to see. – smp7d Sep 21 '11 at 15:34
-
@Dirk, Thanks for the link. I have a helper method that looks at the end of the filename and uses GZIPInputStream or GZIPOutputStream as appropriate. You may want BufferedInputStream before the GZIP as well. – Peter Lawrey Sep 21 '11 at 15:39