|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--uk.org.ogsadai.common.NetUtilities
Contains helper methods relating to the java.net
package, such as methods to read data from URLs.
| Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
|
| Constructor Summary | |
NetUtilities()
|
|
| Method Summary | |
static java.lang.String |
getMachineIPAddress()
Retrieve the IP address of the machine which is running the activity |
static org.w3c.dom.Document |
readToDocument(java.lang.String url,
boolean validate)
Returns a string containing the data read from a specified URL. |
static java.lang.String |
readToString(java.lang.String url)
Returns a string containing the data read from a specified URL. |
static java.lang.String |
readToString(java.net.URL url)
Returns a string containing the data read from a specified URL. |
static boolean |
sameFile(java.net.URL url1,
java.net.URL url2)
Return a flag indicating whether two file URLs point to the same file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
| Constructor Detail |
public NetUtilities()
| Method Detail |
public static org.w3c.dom.Document readToDocument(java.lang.String url,
boolean validate)
throws DAIMalformedURLException,
DAIURLReadIOException,
XMLParseException
Note that special care is needed when expressing file URLs. The following
forms are acceptable: file:/C:/hello.txt or
file:///C:/hello.txt but not
file://C:/hello.txt.
url - The URL to read.validate - Validate the document.
String containing the data read from the URL.
DAIMalformedURLException - if the URL is malformed.
DAIURLReadIOException - if there is a problem reading the URL.
XMLParseException - if there is a problem with the XML.readToString(java.net.URL),
XMLUtilities.xmlStringToDOM(java.lang.String,
boolean)
public static java.lang.String readToString(java.lang.String url)
throws DAIMalformedURLException,
DAIURLReadIOException
Note that special care is needed when expressing file URLs. The following
forms are acceptable: file:/C:/hello.txt or
file:///C:/hello.txt but not
file://C:/hello.txt.
url - The URL to read.
String containing the data read from the URL.
DAIMalformedURLException - if the URL is malformed.
DAIURLReadIOException - if there is a problem reading the URL.readToString(java.net.URL)
public static java.lang.String readToString(java.net.URL url)
throws DAIURLReadIOException
Note that special care is needed when expressing file URLs. The
following forms are acceptable: file:/C:/hello.txt
or file:///C:/hello.txt but not
file://C:/hello.txt.
url - The URL to read.
Document containing the data read from
the URL.
DAIURLReadIOException - if there is a problem reading
the URL.
public static boolean sameFile(java.net.URL url1,
java.net.URL url2)
url1 - First file URL.url2 - Second file URL.
true if both URLs point to the same file,
otherwise return false
public static java.lang.String getMachineIPAddress()
throws java.net.UnknownHostException
java.net.UnknownHostException - If there was a problem retrieving the host address
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||