public class HttpConnection
extends java.lang.Object
HttpConnection connection = new HttpConnection(); connection.doGet("http://www.google.com"); InputStream stream = connection.getStream(); if (stream != null) { //use this stream, for buffer reading, or XML SAX parsing, or whatever... } connection.close();
Constructor and Description |
---|
HttpConnection() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Calling close once is mandatory.
|
void |
doGet(java.lang.String sUrl) |
void |
doPost(java.lang.String sUrl,
java.util.List<NameValuePair> nameValuePairs) |
java.lang.String |
getContentAsString() |
java.io.InputStream |
getStream() |
void |
setUserAgent(java.lang.String userAgent) |
public void setUserAgent(java.lang.String userAgent)
public void doGet(java.lang.String sUrl)
sUrl
- url to getpublic void doPost(java.lang.String sUrl, java.util.List<NameValuePair> nameValuePairs)
public java.io.InputStream getStream()
public java.lang.String getContentAsString()
public void close()