This is a java program to decompress the given image.we have first initialized the given file using file input stream reader and read character by character from input file and copied into the target file and displayed the size of the image.The program is as follows.
import java.io.*;
import java.util.zip.*;
class Izip{public static void main(String args[])throws Exception
{
InflaterInputStream in=new InflaterInputStream(new FileInputStream("Ashes.zip"));
FileOutputStream sout=new FileOutputStream("Ashes.bmp");
int b;
while((b=in.read())!=-1)
sout.write(b);
in.close();
sout.close();
File f1=new File("Ashes.zip");
File f2=new File("Ashes.bmp");
System.out.println("The size of zipped file is "+f1.length());
System.out.println("The size of unzipped file is "+f2.length());
}
}
OUTPUT:
C:\jdk1.3\bin>javac Izip.java
C:\jdk1.3\bin>java IzipThe size of zipped file is 1372The size of unzipped file is 589878
Sunday, March 07, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment