|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.atunes.kernel.utils.NetworkUtils
public class NetworkUtils
Utility methods for network access.
Constructor Summary | |
---|---|
NetworkUtils()
|
Method Summary | |
---|---|
static java.lang.String |
encodeString(java.lang.String s)
Encodes a string in a format suitable to send a http request. |
static java.net.HttpURLConnection |
getConnection(java.lang.String urlString,
Proxy proxy)
Returns a HttpURLConnection specified by a given URL and Proxy. |
static java.awt.Image |
getImage(java.net.URLConnection connection)
Reads a Image from a given URLConnection. |
static Proxy |
getProxy(ProxyBean proxy)
Returns a net.sourceforge.atunes.kernel.modules.proxy.Proxy for a given ProxyBean |
static java.lang.String |
readPostURL(java.net.HttpURLConnection connection,
java.lang.String post)
Sends a HTTP-Post query to a given URLConnection and reads and returns the answer. |
static java.lang.String |
readURL(java.net.URLConnection connection)
Reads a String from a given URLConnection. |
static java.lang.String |
readURL(java.net.URLConnection connection,
java.lang.String charset)
Reads a String from a given URLConnection with a given charset encoding. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NetworkUtils()
Method Detail |
---|
public static java.lang.String encodeString(java.lang.String s)
s
- The String that should be encoded
public static java.net.HttpURLConnection getConnection(java.lang.String urlString, Proxy proxy) throws java.io.IOException
urlString
- A URL as Stringproxy
- A proxy
java.io.IOException
- If an IO exception occurspublic static java.awt.Image getImage(java.net.URLConnection connection) throws java.io.IOException
connection
- A URLConnection
java.io.IOException
- If an IO exception occurspublic static Proxy getProxy(ProxyBean proxy) throws java.net.UnknownHostException, java.io.IOException
proxy
- A ProxyBean
java.net.UnknownHostException
- If the host is unknown
java.io.IOException
- If an IO exception occurspublic static java.lang.String readPostURL(java.net.HttpURLConnection connection, java.lang.String post) throws java.io.IOException
connection
- A URLConnectionpost
- The HTTP-Post query
java.io.IOException
- If an IO exception occurspublic static java.lang.String readURL(java.net.URLConnection connection) throws java.io.IOException
connection
- A URLConnection
java.io.IOException
- If an IO exception occurspublic static java.lang.String readURL(java.net.URLConnection connection, java.lang.String charset) throws java.io.IOException
connection
- A URLConnectioncharset
- A charset as String, e.g. "UTF-8"
java.io.IOException
- If an IO exception occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |