class URLEncodingUtilities {

    public static URL encodeURL(URL url)
    {
        URL encodedURL = null;
        if (url != null)
        {
            UrlBuilder builder = new UrlBuilder(url);

            // Encode the query parameters
            builder.setQueryParameters(encodeQueryParameters(builder.getQueryParameters()));

            // Build the encoded URL
            try
            {
                encodedURL = builder.toURL();
            }
            catch (MalformedURLException e)
            {
                encodedURL = url;
            }
        }
        return encodedURL;
    }

    private  URLEncodingUtilities();

}