import java.io.*; public class Test { public static void main(String argv[]) throws Exception { String inFile = argv[0]; String outFile = argv[0]+".compressed"; FileInputStream fis = new FileInputStream(inFile); FileOutputStream fos = new FileOutputStream(outFile); CompressedOutputStream cos = new CompressedOutputStream(fos,2000); while (true) { int b = fis.read(); if (b == -1) break; cos.write(b); if (fis.available() == 0) cos.flush(); } cos.close(); fis.close(); fis = new FileInputStream(outFile); CompressedInputStream cis = new CompressedInputStream(fis); while (true) { int b = cis.read(); if (b == -1) break; System.out.print(""+(char)b); } cis.close(); } }