I am trying to write a function which will accept an InputStream with zipped file data and would return another InputStream with unzipped data.
The zipped file will only contain a single file and thus there is no requirement of creating directories, etc…
I tried looking at ZipInputStream and others but I am confused by so many different types of streams in Java.
Concepts
GZIPInputStream is for streams (or files) zipped as gzip (".gz" extension). It doesn’t have any header information.
If you have a real zip file, you have to use ZipFile to open the file, ask for the list of files (one in your example) and ask for the decompressed input stream.
Your method, if you have the file, would be something like:
Reading an InputStream with the content of a .zip file
Ok, if you have an InputStream you can use (as @cletus says) ZipInputStream. It reads a stream including header data.
Important: if you have the file in your PC you can use
ZipFileclass to access it randomlyThis is a sample of reading a zip-file through an InputStream: