uk.org.ogsadai.common
  Class NetUtilities
  
java.lang.Object
  |
  +--uk.org.ogsadai.common.NetUtilities
  
  
    - public class NetUtilities
- extends java.lang.Object
Contains helper methods relating to the java.net package, such as methods to read data from URLs.
  
  
  
    - Author:
- The OGSA-DAI Project Team
  
    
    
  
    
      | 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 | 
  
 
  
  
  COPYRIGHT_NOTICE
  
private static final java.lang.String COPYRIGHT_NOTICE
  
    - 
      
        - See Also:
- Constant Field Values
 
NetUtilities
  
public NetUtilities()
  
readToDocument
  
public static org.w3c.dom.Document readToDocument(java.lang.String url,
                                                  boolean validate)
                                           throws DAIMalformedURLException,
                                                  DAIURLReadIOException,
                                                  XMLParseException
  
    - 
      Returns a string containing the data read from a specified URL.
      Note that special care is needed when expressing file URLs. The following forms are acceptable: file:/C:/hello.txtorfile:///C:/hello.txtbut notfile://C:/hello.txt.
 
- 
      
        - Parameters:
- url- The URL to read.
- validate- Validate the document.
- Returns:
- a Stringcontaining the data read from the URL.
- Throws:
- DAIMalformedURLException- if the URL is malformed.
- DAIURLReadIOException- if there is a problem reading the URL.
- XMLParseException- if there is a problem with the XML.
- See Also:
- readToString(java.net.URL),- XMLUtilities.xmlStringToDOM(java.lang.String, boolean)
 
  
  readToString
  
public static java.lang.String readToString(java.lang.String url)
                                     throws DAIMalformedURLException,
                                            DAIURLReadIOException
  
    - 
      Returns a string containing the data read from a specified URL.
      Note that special care is needed when expressing file URLs. The following forms are acceptable: file:/C:/hello.txtorfile:///C:/hello.txtbut notfile://C:/hello.txt.
 
- 
      
        - Parameters:
- url- The URL to read.
- Returns:
- a Stringcontaining the data read from the URL.
- Throws:
- DAIMalformedURLException- if the URL is malformed.
- DAIURLReadIOException- if there is a problem reading the URL.
- See Also:
- readToString(java.net.URL)
 
  
  readToString
  
public static java.lang.String readToString(java.net.URL url)
                                     throws DAIURLReadIOException
  
    - 
      Returns a string containing the data read from a specified URL.
      Note that special care is needed when expressing file URLs. The following forms are acceptable: file:/C:/hello.txtorfile:///C:/hello.txtbut notfile://C:/hello.txt.
 
- 
      
        - Parameters:
- url- The URL to read.
- Returns:
- a Documentcontaining the data read from the URL.
- Throws:
- DAIURLReadIOException- if there is a problem reading the URL.
 
  
  sameFile
  
public static boolean sameFile(java.net.URL url1,
                               java.net.URL url2)
  
    - 
      Return a flag indicating whether two file URLs point to the same file.
      
    
- 
      
        - Parameters:
- url1- First file URL.
- url2- Second file URL.
- Returns:
- trueif both URLs point to the same file, otherwise return- false
 
  
  getMachineIPAddress
  
public static java.lang.String getMachineIPAddress()
                                            throws java.net.UnknownHostException
  
    - 
      Retrieve the IP address of the machine which is running the activity
      
    
- 
      
        - Returns:
- IP address
- Throws:
- java.net.UnknownHostException- If there was a problem retrieving the host address