Skip to content

Instantly share code, notes, and snippets.

Created October 4, 2015 21:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Inflating hex data (IDAT section from a PNG file)
import java.util.Arrays;
import javax.xml.bind.DatatypeConverter;
public class Inflate {
public static void main(String[] args) throws Exception {
String input = "6881EDC1010D000000C2A0F74F6D0E37A00000000000000000BE0D21000001";
byte[] deflated = DatatypeConverter.parseHexBinary(input);
ByteArrayInputStream bais = new ByteArrayInputStream(deflated);
InflaterInputStream iis = new InflaterInputStream(bais);
byte[] inflated = new byte[256*256];
int size =;
System.out.println(DatatypeConverter.printHexBinary(Arrays.copyOf(inflated, size)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment