[FOray-commit] SF.net SVN: foray: [7785] trunk/foray/foray-font/src/java/org/foray/font
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-07-15 23:38:25
|
Revision: 7785 Author: victormote Date: 2006-07-15 16:38:12 -0700 (Sat, 15 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7785&view=rev Log Message: ----------- Remove some no-longer-needed methods. Modified Paths: -------------- trunk/foray/foray-common/src/java/org/foray/common/url/URLUtil.java trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFReader.java Modified: trunk/foray/foray-common/src/java/org/foray/common/url/URLUtil.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/url/URLUtil.java 2006-07-15 23:09:14 UTC (rev 7784) +++ trunk/foray/foray-common/src/java/org/foray/common/url/URLUtil.java 2006-07-15 23:38:12 UTC (rev 7785) @@ -24,19 +24,13 @@ package org.foray.common.url; - -import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; /** - * This utility class is used to build URLs from Strings. The String can be - * normal URLs but also just filenames. The filenames get converted to a - * file URL. - * - * @author Jeremias Maerki + * This utility class contains various URL-related static utility methods. */ public class URLUtil { @@ -45,52 +39,6 @@ } /** - * Build an URL based on a String. The String can be a normal URL or a - * filename. Filenames get automatically converted to to URLs. - * - * @param spec A URL or a filename - * @return The requested URL - * @throws MalformedURLException If spec cannot be converted to a URL. - */ - public static URL buildURL(String spec) throws MalformedURLException { - if (spec == null) { - throw new NullPointerException("spec must not be null"); - } - File f = new File(spec); - if (f.exists()) { - return f.toURL(); - } - return URLFactory.createURL(spec); - } - - - /** - * Build an URL based on a String. The String can be a normal URL or a - * filename. Filenames get automatically converted to to URLs. - * - * @param baseURL Base URL for relative paths - * @param spec A URL or a filename - * @return The requested URL - * @throws MalformedURLException If spec cannot be converted to a URL. - */ - public static URL buildURL(URL baseURL, String spec) - throws MalformedURLException { - if (spec == null) { - throw new NullPointerException("spec must not be null"); - } - try { - URL u1 = buildURL(spec); - return u1; - } catch (MalformedURLException mfue) { - if (baseURL == null) { - throw mfue; - } - URL u2 = URLFactory.createURL(baseURL, spec); - return u2; - } - } - - /** * <p>This method is an attempt to standardize the way that URLs are * constructed, and, more importantly, how they are converted into * Streams or other i/o resources. There is no way to know when a URL Modified: trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java 2006-07-15 23:09:14 UTC (rev 7784) +++ trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java 2006-07-15 23:38:12 UTC (rev 7785) @@ -26,7 +26,6 @@ import org.foray.common.Environment; import org.foray.common.RandomReader; -import org.foray.common.url.URLUtil; import org.foray.common.url.URLFactory; import org.foray.ps.encode.EncodingParser; import org.foray.ps.encode.EncodingVector; @@ -367,7 +366,7 @@ if (xmlBase != null && !xmlBase.equals("")) { try { /* Update the current xml base. */ - this.currentXMLBase = URLUtil.buildURL(this.previousXMLBase, + this.currentXMLBase = URLFactory.createURL(this.previousXMLBase, xmlBase); } catch (MalformedURLException e) { logError("Unable to create URL from " @@ -562,7 +561,7 @@ } try { /* Update the current xml base. */ - this.currentXMLBase = URLUtil.buildURL(this.currentXMLBase, + this.currentXMLBase = URLFactory.createURL(this.currentXMLBase, xmlBase); } catch (MalformedURLException e) { logError("Unable to create URL from " Modified: trunk/foray/foray-font/src/java/org/foray/font/format/TTFReader.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/format/TTFReader.java 2006-07-15 23:09:14 UTC (rev 7784) +++ trunk/foray/foray-font/src/java/org/foray/font/format/TTFReader.java 2006-07-15 23:38:12 UTC (rev 7785) @@ -25,7 +25,7 @@ package org.foray.font.format; import org.foray.common.Logging; -import org.foray.common.url.URLUtil; +import org.foray.common.url.URLFactory; import org.apache.commons.logging.Log; @@ -52,7 +52,7 @@ /** * The main method (accessible from command-line) for the TTFReader tool. - * @param args Command-line arguments: <ttc-file> + * @param args The command-line arguments. <ttc-file> */ public static void main(String[] args) { TTFReader app = new TTFReader(); @@ -79,7 +79,7 @@ } FontFileReader reader = null; try { - URL url = URLUtil.buildURL(fileName); + URL url = URLFactory.createURL(fileName); reader = new FontFileReader(logger, url); } catch (MalformedURLException e1) { logger.error("Malformed URL: " + fileName); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |