I am very new to Java.
I have some codes to compress like below:
public void compress(OutputStream out) throws IOException
{
Deflater deflater = new Deflater(1);
DeflaterOutputStream zOut = new DeflaterOutputStream(out, deflater, 1024);
DataOutputStream stream = new DataOutputStream(zOut);
stream.writeShort(200);
stream.write("test".getBytes("utf-8"));
zOut.close();
deflater.end();
}
And I am using that function as below:
compress c = new compress();
FileOutputStream fis = new FileOutputStream("D:\\Temp\\file.bin");
OutputStream out = fis;
c.compress(out);
fis.close();
Now, I need to decompress my file.bin file.
I have looked up several samples, but none of them shows me about the compression level.
The constructor of Deflater has 1 argument which is compression level.
Don't I have to mention that when decompressing it?
Anyway, please show me the proper way to decompress this.
Thanks in advance.