Rectangle 27 0

java Read from InputStream in multiple formats?


Read from InputStream in multiple formats?

Actually, I just noticed that there is a way to force URLConnections to use no proxy. I guess that'll work.

I'd fork an existing implementation rather than starting from scratch, if you cannot find a configuration parameter to do what you need. You shouldn't have any licensing issues doing this with Apache Commons HttpClient as mentioned in another answer.

I'm writing my own because, in part of the application, I need to disregard the http.proxyHost setting that is being used in another part.

There is already a class in Java for handling HTTP requests and responses. You should use that instead of trying to parse the response on your own. Parsing HTTP response is more difficult than you think as there are different encoding methods that you have to deal with. It isn't really raw binary data in the response payload. The HttpURLConnection class will parse headers for you and give you InputStream for the payload.

Note