gov.llnl.babel.url

Class 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.

Method Summary

static void
enableHTTPS()
Try to enable HTTPS support.
static String
expandURL(String url)
Expand an improperly formatted file URL to a properly formatted URL.
static String
readURL(String url)
Read data from a properly formatted URL and return it as a string.

Method Details

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.

expandURL

public static String expandURL(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.

readURL

public static String readURL(String url)
            throws MalformedURLException,
                   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.