Example of InflaterInputStream in Java
November 13, 2023
In Java, InflaterInputStream
reads the data of deflate format. InflaterInputStream
belongs to the package java.util.zip
. InflaterInputStream
uncompresses the data of deflate format and provides input stream to be written in other source.
Find the example of
InflaterInputStream
.
Example
InflaterInputStreamTestpackage com.concretepage; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.InflaterInputStream; public class InflaterInputStreamTest { public static void main(String[] args) throws IOException { FileInputStream fin = new FileInputStream("D:\\page\\tsetfile.dfl"); FileOutputStream fout = new FileOutputStream("D:\\page\\file.txt"); InflaterInputStream infis = new InflaterInputStream(fin); int c = 0; while ((c = infis.read()) != -1) { fout.write(c); } infis.close(); fout.close(); } }