Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main;
- import java.io.ByteArrayOutputStream;
- import java.util.zip.DataFormatException;
- import java.util.zip.Inflater;
- public class Decompresser {
- public static byte[] decompress(byte[] demoin) {
- try {
- Inflater decompresser = new Inflater();
- decompresser.setInput(demoin);
- ByteArrayOutputStream decompressingstream = new ByteArrayOutputStream(demoin.length);
- byte[] buffer = new byte[1024];
- while (!decompresser.finished()) {
- int count = decompresser.inflate(buffer);
- decompressingstream.write(buffer, 0, count);
- }
- byte[] demoout = decompressingstream.toByteArray();
- decompresser.end();
- return demoout;
- } catch (DataFormatException e) {
- e.printStackTrace();
- }
- return (new byte[0]);
- }
- }
Add Comment
Please, Sign In to add comment