Created
October 4, 2015 21:48
-
-
Save michaeltandy/c051db2243e679e78a37 to your computer and use it in GitHub Desktop.
Inflating hex data (IDAT section from a PNG file)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.Arrays; | |
import java.util.zip.InflaterInputStream; | |
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 = iis.read(inflated); | |
System.out.println(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