So, i'm hoping some of you guys can help me with my problem. Unfortunately I need to roll my own HTTPClient. I have spent quite sometime researching sockets and have a rough client working. It grabs text/html just fine. However, as soon as I try to get a response that is of Encoding-Type: gzip I cannot seem to get the ByteArray to unzip. I get the following error: java.io.IOException: Not in GZIP format
I know it has gotta be how i'm storing the zipped data that might be the issue. I have noticed that the header for content-type tells me the length should be 12342 however after getting all the data my ByteBuffer has a capacity of 13245. That seems a bit strange?
I was hoping you guys would not mind looking at my code see if it looks logically correct?
I have embedded comments in code to show what i'm doing any ideas about why my ByteBuffer.capacity would be larger than header states it should be? This is the same when I pull text/html responses the ByteBuffer.capacity is larger than content length? So, i'm hoping if I figure this out this will fix my GZIP issue!
So, I have found if I take the ByteBuffer and convert it into string and then get the length its correct? What is inside the ByteBuffer that's being stripped when its converted to as string?
posted 9 years ago
So, here is the format of the bytes of the gzip data before attempting to pass it into the GZIPInputStream.