title: GZIPInputStream reading line by line
body: <p>I have a file in .gz format. The java class for reading this file is GZIPInputStream. 
  However, this class doesn't extend the BufferedReader class of java. As a result, I am not able to read the file line by line. I need something like this</p>
  
  <pre><code>reader  = new MyGZInputStream( some constructor of GZInputStream) 
  reader.readLine()...
  </code></pre>
  
  <p>I though of creating my class which extends the Reader or BufferedReader class of java and use GZIPInputStream as one of its variable.</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.FileInputStream;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  import java.io.Reader;
  import java.util.zip.GZIPInputStream;
  
  public class MyGZFilReader extends Reader {
  
      private GZIPInputStream gzipInputStream = null;
      char[] buf = new char[1024];
  
      @Override
      public void close() throws IOException {
          gzipInputStream.close();
      }
  
      public MyGZFilReader(String filename)
                 throws FileNotFoundException, IOException {
          gzipInputStream = new GZIPInputStream(new FileInputStream(filename));
      }
  
      @Override
      public int read(char[] cbuf, int off, int len) throws IOException {
          // TODO Auto-generated method stub
          return gzipInputStream.read((byte[])buf, off, len);
      }
  
  }
  </code></pre>
  
  <p>But, this doesn't work when I use</p>
  
  <pre><code>BufferedReader in = new BufferedReader(
      new MyGZFilReader("F:/gawiki-20090614-stub-meta-history.xml.gz"));
  System.out.println(in.readLine());
  </code></pre>
  
  <p>Can someone advice how to proceed ..</p>