示例#1
0
文件: GZIPIn.java 项目: dirkk/basex
 @Override
 public void close() {
   try {
     zis.close();
   } catch (final IOException ex) {
     Util.debug(ex);
   }
 }
  public void decompress(String source, String destination) throws IOException {
    GZIPInputStream gzipInputStream = null;

    gzipInputStream = new GZIPInputStream(new FileInputStream(source));

    String outFilename = source + ".txt";
    OutputStream out = new FileOutputStream(outFilename);

    byte[] buf = new byte[1024];

    int len;
    while ((len = gzipInputStream.read(buf)) > 0) {
      out.write(buf, 0, len);
    }

    gzipInputStream.close();
    out.close();
  }