home *** CD-ROM | disk | FTP | other *** search
- import java.io.BufferedInputStream;
- import java.io.BufferedOutputStream;
- import java.io.DataInputStream;
- import java.io.DataOutputStream;
- import java.io.EOFException;
- import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.io.FilterInputStream;
- import java.io.FilterOutputStream;
- import java.io.IOException;
-
- public class Compress {
- private static final int empty = -1;
- private BufferedInputStream input;
- private BufferedOutputStream output;
- private CompressTable String_T;
- // $FF: renamed from: C int
- private int field_0;
- // $FF: renamed from: WC int
- private int field_1;
- // $FF: renamed from: W int
- private int field_2;
- private int Output_Code = -1;
- private int iEnd;
-
- public void WriteCode(int var1) throws IOException {
- if (this.Output_Code == -1) {
- this.output.write(var1 >>> 4 & 255);
- this.Output_Code = var1 & 15;
- } else {
- this.output.write(this.Output_Code << 4 & 4080 | var1 >>> 8 & 15);
- this.output.write(var1 & 255);
- this.Output_Code = -1;
- }
- }
-
- public Compress(BufferedInputStream var1, BufferedOutputStream var2) {
- this.input = var1;
- this.output = var2;
- this.iEnd = 0;
- this.String_T = new CompressTable();
- }
-
- public static void main(String[] var0) {
- Compress var5 = null;
- if (var0.length == 0 || var0.length > 2) {
- System.out.println("Usage: java Compress Source Dest");
- System.exit(0);
- }
-
- try {
- DataInputStream var1 = new DataInputStream(new FileInputStream(var0[0]));
- DataOutputStream var2 = new DataOutputStream(new FileOutputStream(var0[1]));
- BufferedInputStream var3 = new BufferedInputStream(var1, 16384);
- BufferedOutputStream var4 = new BufferedOutputStream(var2, 16384);
- var5 = new Compress(var3, var4);
- var5.ZLW();
- ((FilterInputStream)var3).close();
- ((FilterOutputStream)var4).close();
- ((FilterInputStream)var1).close();
- ((FilterOutputStream)var2).close();
- } catch (IOException var6) {
- }
- }
-
- public void ZLW() throws IOException {
- short var1 = 32767;
- byte var2 = -1;
-
- try {
- this.field_0 = this.input.read();
- this.field_2 = this.String_T.Lookup_String(var1, this.field_0);
- this.field_0 = this.input.read();
-
- try {
- while(true) {
- this.field_1 = this.String_T.Lookup_String(this.field_2, this.field_0);
- if (this.field_1 == var2) {
- this.String_T.Make_Table_Element(this.field_2, this.field_0);
- this.WriteCode(this.field_2);
- this.field_2 = this.String_T.Lookup_String(var1, this.field_0);
- } else {
- this.field_2 = this.field_1;
- }
-
- if ((this.field_0 = this.input.read()) == -1) {
- if (++this.iEnd >= 4) {
- throw new EOFException();
- }
-
- this.field_0 = 13;
- }
- }
- } catch (EOFException var3) {
- this.WriteCode(this.field_2);
- this.output.flush();
- }
- } catch (IOException var4) {
- }
- }
- }
-