final protected void defineRawInputStream( InputStream inputStream ) throws IOException { if (_inputStream != null || _responseText != null) { throw new IllegalStateException( "Must be called before response text is defined." ); } // please note bug report [ 1119205 ] EOFExceptions while using a Proxy // and patch proposal below // by Ralf Bust /* original 1.6.2 code if (encodedUsingGZIP()) { byte[] compressedData = readFromStream( inputStream, getContentLength() ); _inputStream = new GZIPInputStream( new ByteArrayInputStream( compressedData ) ); } else { _inputStream = inputStream; }*/ if (encodedUsingGZIP()) { try { _inputStream = new GZIPInputStream( inputStream ); } catch (EOFException eof) { _inputStream = inputStream; } } else { _inputStream = inputStream; } }
final protected void defineRawInputStream( InputStream inputStream ) throws IOException { if (_inputStream != null || _responseText != null) { throw new IllegalStateException( "Must be called before response text is defined." ); } // please note bug report [ 1119205 ] EOFExceptions while using a Proxy // and patch proposal below // by Ralf Bust /* original 1.6.2 code if (encodedUsingGZIP()) { byte[] compressedData = readFromStream( inputStream, getContentLength() ); _inputStream = new GZIPInputStream( new ByteArrayInputStream( compressedData ) ); } else { _inputStream = inputStream; }*/ if (encodedUsingGZIP()) { try { _inputStream = new GZIPInputStream( inputStream ); } catch (EOFException eof) { _inputStream = inputStream; } } else { _inputStream = inputStream; } }
final protected void defineRawInputStream( InputStream inputStream ) throws IOException { if (_inputStream != null || _responseText != null) { throw new IllegalStateException( "Must be called before response text is defined." ); } // please note bug report [ 1119205 ] EOFExceptions while using a Proxy // and patch proposal below // by Ralf Bust /* original 1.6.2 code if (encodedUsingGZIP()) { byte[] compressedData = readFromStream( inputStream, getContentLength() ); _inputStream = new GZIPInputStream( new ByteArrayInputStream( compressedData ) ); } else { _inputStream = inputStream; }*/ if (encodedUsingGZIP()) { try { _inputStream = new GZIPInputStream( inputStream ); } catch (EOFException eof) { _inputStream = inputStream; } } else { _inputStream = inputStream; } }
protected void loadResponseText() throws IOException { if (_responseText != null) throw new IllegalStateException( "May only invoke loadResponseText once" ); _responseText = ""; InputStream inputStream = getInputStream(); try { final int contentLength = this.encodedUsingGZIP() ? -1 : getContentLength(); int bytesRemaining = contentLength < 0 ? Integer.MAX_VALUE : contentLength; byte[] bytes = readFromStream( inputStream, bytesRemaining ); readTags( bytes ); _responseText = new String( bytes, getCharacterSet() ); _inputStream = new ByteArrayInputStream( bytes ); if (HttpUnitOptions.isCheckContentLength() && contentLength >= 0 && bytes.length != contentLength) { throw new IOException("Truncated message. Expected length: " + contentLength + ", Actual length: " + bytes.length); } } finally { inputStream.close(); } }
protected void loadResponseText() throws IOException { if (_responseText != null) throw new IllegalStateException( "May only invoke loadResponseText once" ); _responseText = ""; InputStream inputStream = getInputStream(); try { final int contentLength = this.encodedUsingGZIP() ? -1 : getContentLength(); int bytesRemaining = contentLength < 0 ? Integer.MAX_VALUE : contentLength; byte[] bytes = readFromStream( inputStream, bytesRemaining ); readTags( bytes ); _responseText = new String( bytes, getCharacterSet() ); _inputStream = new ByteArrayInputStream( bytes ); if (HttpUnitOptions.isCheckContentLength() && contentLength >= 0 && bytes.length != contentLength) { throw new IOException("Truncated message. Expected length: " + contentLength + ", Actual length: " + bytes.length); } } finally { inputStream.close(); } }
protected void loadResponseText() throws IOException { if (_responseText != null) throw new IllegalStateException( "May only invoke loadResponseText once" ); _responseText = ""; InputStream inputStream = getInputStream(); try { final int contentLength = this.encodedUsingGZIP() ? -1 : getContentLength(); int bytesRemaining = contentLength < 0 ? Integer.MAX_VALUE : contentLength; byte[] bytes = readFromStream( inputStream, bytesRemaining ); readTags( bytes ); _responseText = new String( bytes, getCharacterSet() ); _inputStream = new ByteArrayInputStream( bytes ); if (HttpUnitOptions.isCheckContentLength() && contentLength >= 0 && bytes.length != contentLength) { throw new IOException("Truncated message. Expected length: " + contentLength + ", Actual length: " + bytes.length); } } finally { inputStream.close(); } }