KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openlaszlo > test > gunzip


1 /* *****************************************************************************
2  * gunzip.java
3  * ****************************************************************************/

4
5 /* J_LZ_COPYRIGHT_BEGIN *******************************************************
6 * Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
7 * Use is subject to license terms. *
8 * J_LZ_COPYRIGHT_END *********************************************************/

9
10 package org.openlaszlo.test;
11
12 import java.io.*;
13 import org.openlaszlo.utils.FileUtils;
14
15 public class gunzip {
16    static public void main (String JavaDoc args[]) {
17        try {
18            if (!args[0].endsWith(".gz")) {
19                System.err.println("filename must end with .gz");
20                System.exit(-1);
21            }
22            File src = new File (args[0]);
23            String JavaDoc out = args[0].substring(0, args[0].length() - 3);
24            File dest = new File (out);
25            long then = System.currentTimeMillis();
26            FileUtils.decode(src, dest, "gzip");
27            long now = System.currentTimeMillis();
28            System.out.println("wrote " + out + " in " + (now - then) + " msecs");
29        } catch (Exception JavaDoc e) {
30            e.printStackTrace();
31        }
32    }
33 }
34
Popular Tags