Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.util.Arrays;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;

public class Main {
    private static byte[] expand(byte[] bytes, int skip) {
        byte[] newBytes = new byte[bytes.length - skip];
        Inflater inflater = new Inflater();

        inflater.setInput(bytes, skip, newBytes.length);
        try {
            int outCount = inflater.inflate(newBytes);
            System.arraycopy(newBytes, 0, bytes, skip, outCount);
            Arrays.fill(bytes, skip + outCount, bytes.length, (byte) 0);
            return bytes;
        } catch (DataFormatException e) {
        }

        return null;
    }
}