I have an array of bytes, The Hex starts (it's big) with this:
78 9C 9D 5B 4B 6F A4 38 10 FE 2F 9C 19 89 F2 83 47 1F 77 46 7B DA D3 CE 6A 2F A3 08 91 B4 93 B4 96 40 0B E8 64 A2 28 FF 7D A1 B1 3B 2E C0 ED 72 4F 94 E9 04 EA 61 57 7D F5 32 E4 23 7A AB 5E 55 D9 9C 5E A2 5D 01 10 47 55 B3 EF DA C3 BE 7C A8 0F AA 19 A2 DD D0 9D
It starts with 0x789c which is the lzma headers.
I am running it through the following method:
public byte[] decompress(byte[] bytesToDecompress)
{
byte[] returnValues = null;
Inflater inflater = new Inflater();
int numberOfBytesToDecompress = bytesToDecompress.length;
inflater.setInput
(
bytesToDecompress,
0,
numberOfBytesToDecompress
);
int bufferSizeInBytes = numberOfBytesToDecompress;
int numberOfBytesDecompressedSoFar = 0;
List<Byte> bytesDecompressedSoFar = new ArrayList<Byte>();
try
{
while (inflater.needsInput() == false)
{
byte[] bytesDecompressedBuffer = new byte[bufferSizeInBytes];
int numberOfBytesDecompressedThisTime = inflater.inflate
(
bytesDecompressedBuffer
);
numberOfBytesDecompressedSoFar += numberOfBytesDecompressedThisTime;
for (int b = 0; b < numberOfBytesDecompressedThisTime; b++)
{
bytesDecompressedSoFar.add(bytesDecompressedBuffer[b]);
}
}
returnValues = new byte[bytesDecompressedSoFar.size()];
for (int b = 0; b < returnValues.length; b++)
{
returnValues[b] = (byte)(bytesDecompressedSoFar.get(b));
}
}
catch (DataFormatException dfe)
{
dfe.printStackTrace();
}
inflater.end();
return returnValues;
}
public String decompressToString(byte[] bytesToDecompress)
{
byte[] bytesDecompressed = this.decompress
(
bytesToDecompress
);
String returnValue = null;
try
{
returnValue = new String
(
bytesDecompressed,
0,
bytesDecompressed.length,
"UTF-8"
);
}
catch (UnsupportedEncodingException uee)
{
uee.printStackTrace();
}
return returnValue;
}
Like this:
System.out.println(decompressToString(jsonDecompressed));
However I am getting nothing printed out.. There is also no stacktrace...
How come this is happening?