Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
MapReduce >> mail # user >> Example on how to decompress the output file?


Copy link to this message
-
Re: Example on how to decompress the output file?
On 07/05/2011 11:24 AM, Pedro Sa Costa wrote:
>
> Hi,
>
> In my hadoop running example, the data ouput is compressed using gzip. I would
> like to create a small java program that decompress the output.  Can anyone
> give an example on how to decompress the output in java using the hadoop API?

Write a Java app which read from an input stream (until EOF), where the
input stream is like so:

FileSystem fs = FileSystem.getLocal(conf);
InputStream hdfsIn = fs.open(filePath);
InputStream in = new GZIPInputStream(hdfsIn);

DR