gov.llnl.babel.url
Class URLUtilities

java.lang.Object
  extended by gov.llnl.babel.url.URLUtilities

public class URLUtilities
extends java.lang.Object

Utility class URLUtiliites is a collection of common URL utility functions. All methods are declared as static. Supported operations include expanding a file URL, reading the data from a URL and returning it as a string, and enabling HTTPS support.


Constructor Summary
URLUtilities()
           
 
Method Summary
static void enableHTTPS()
          Try to enable HTTPS support.
static java.lang.String expandURL(java.lang.String url)
          Expand an improperly formatted file URL to a properly formatted URL.
static java.lang.String readURL(java.lang.String url)
          Read data from a properly formatted URL and return it as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLUtilities

public URLUtilities()
Method Detail

readURL

public static java.lang.String readURL(java.lang.String url)
                                throws java.net.MalformedURLException,
                                       java.io.IOException
Read data from a properly formatted URL and return it as a string. This method may throw a MalformedURLException if the URL is improperly formatted or an IOException if there is a problem reading the URL data.

Throws:
java.net.MalformedURLException
java.io.IOException

expandURL

public static java.lang.String expandURL(java.lang.String url)
Expand an improperly formatted file URL to a properly formatted URL. If the URL passed into this function is invalid, then it is assumed to be a file reference and is expanded as such.


enableHTTPS

public static void enableHTTPS()
Try to enable HTTPS support. This method must be called before any attempt to create or use a URL with an HTTPS protocol. This enables HTTPS through the Sun JSSE library. If this library does not exist, then HTTPS is not enabled.