|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.datacrow.core.http.HttpConnection
public class HttpConnection
This class wraps a HttpURLConnection
and offers detailed methods for
retrieving information from an URL. Proxies are supported.
Constructor Summary | |
---|---|
protected |
HttpConnection(java.net.URL url)
Create a new connection. |
Method Summary | |
---|---|
void |
close()
Disconnect, closes the connection. |
boolean |
exists()
Checks if the URL is valid. |
byte[] |
getBytes()
Retrieves the underlying bytes and closes the connection. |
int |
getContentLength()
Retrieves the content length. |
java.io.InputStream |
getInputStream()
Create an output stream for uploading purposes. |
java.io.OutputStream |
getOutputStream()
Create an output stream for uploading purposes. |
java.lang.String |
getString()
Retrieves the underlying text (as UTF8). |
java.lang.String |
getString(java.lang.String charset)
Retrieves the underlying text using the specified encoding. |
void |
setContentLength(int length)
Set the content length. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected HttpConnection(java.net.URL url) throws HttpConnectionException
url
-
HttpConnectionException
Method Detail |
---|
public boolean exists()
public java.lang.String getString() throws HttpConnectionException
java.io.IOException
HttpConnectionException
public java.lang.String getString(java.lang.String charset) throws HttpConnectionException
charset
-
java.io.IOException
HttpConnectionException
public final byte[] getBytes() throws HttpConnectionException
java.io.IOException
HttpConnectionException
public int getContentLength()
public void setContentLength(int length)
length
- public java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
public java.io.OutputStream getOutputStream() throws java.io.IOException
java.io.IOException
public void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |