NullPointerException GZIPOutputStream
Does anyone know, why I get a NullPointerException in the line
while (length = in.read(BinaryBody)) != -1)?
byte[] BinaryBody =newbyte[8192];
InputStream in = method.getResponseBodyAsStream();
GZIPOutputStream gzipOut =new GZIPOutputStream(client.getOutputStream());
int length;
while ((length = in.read(BinaryBody)) != -1)
{
gzipOut.write(BinaryBody, 0, length);
gzipOut.flush();
}
gzipOut.close();
[725 byte] By [
Johannesa] at [2007-11-27 6:44:13]

# 1
Oh, I think actually it has to be
byte[] BinaryBody = new byte[8192];
InputStream in = method.getResponseBodyAsStream();
GZIPInputStream gzipIn = new GZIPInputStream(in);
GZIPOutputStream gzipOut = new GZIPOutputStream(client.getOutputStream());
int length;
while ((length = gzipIn.read(BinaryBody)) != -1)
{
gzipOut.write(BinaryBody, 0, length);
gzipOut.flush();
}
gzipOut.close();
gzipIn.close();
I'm writing a Proxyserver and just wanted to forward gzipped Data to the client, but my UA/Browser is getting a timeout after a few minutes, I'm not sure what's wrong :-/
Hrm, I'm getting a NullPointerException in the following line: GZIPInputStream gzipIn = new GZIPInputStream(in);
Message was edited by:
Johannes