Let's go step by step:
You need a
GZIPInputStream
to read zipped data (that and not aGZIPOutputStream
; the output stream is used to compress data). Having this stream you will be able to read the uncompressed, original binary data. This requires anInputStream
in the constructor.You need an input stream capable of reading the Base64 encoded data. I suggest the handy
Base64InputStream
from apache-commons-codec. With the constructor you can set the line length, the line separator and setdoEncode=false
to decode data. This in turn requires another input stream - the raw, Base64 encoded data.This stream depends on how you get your data; ideally the data should be available as
InputStream
- problem solved. If not, you may have to use theByteArrayInputStream
(if binary),StringBufferInputStream
(if string) etc.
Roughly this logic is:
InputStream fromHadoop = ...; // 3rd paragraph
Base64InputStream b64is = // 2nd paragraph
new Base64InputStream(fromHadoop, false, 80, "\n".getBytes("UTF-8"));
GZIPInputStream zis = new GZIPInputStream(b64is); // 1st paragraph
Please pay attention to the arguments of Base64InputStream
(line length and end-of-line byte array), you may need to tweak them.