[kepler-dev] [kepler-cvs] kepler/src/exp/ptolemy/utilFileUtilities.java

Christopher Brooks cxh at eecs.berkeley.edu
Mon Apr 25 18:37:29 PDT 2005


Hi Efrat,

I folded in your changes.  


You wrote:
> The first modification was due to a URI authentication exception when
> trying to create a file object from a URI on the remote side.

That makes sense, the modified nameToFile() is below:

    /** Given a file name or URL, return the file. This method first attempts
     *  to directly use the file name to construct the File. If the
     *  resulting File is not absolute, then it attempts to resolve it
     *  relative to the specified base directory, if there is one.
     *  If there is no such base URI, then it simply returns the
     *  relative File object.
     *  <p>
     *  The file need not exist for this method to succeed.  Thus,
     *  this method can be used to determine whether a file with a given
     *  name exists, prior to calling openForWriting(), for example.
     *  @param name The file name or URL.
     *  @param base The base for relative URLs.
     *  @return A File, or null if the filename argument is null or
     *   an empty string.
     */
    public static File nameToFile(String name, URI base) {
        if ((name == null) || name.trim().equals("")) {
            return null;
        }

        File file = new File(name);

        if (!file.isAbsolute()) {
            // Try to resolve the base directory.
            if (base != null) {
                URI newURI = base.resolve(name);
                String urlString = newURI.toString();
                if (urlString.indexOf("file:/") != -1) {
                    urlString = urlString.substring(6); //Removing 'file:/'
                }
                file = new File(StringUtilities.substitute(urlString,
                                        "%20", " "));
            }
        }

        return file;
    }



>    The second modification was due to the file protocol requirements
>    to use 3 slashes, 'file:///' on the remote side, although it
>    would be probably be a good idea to also make sure first that the
>    url string actually represents the file protocol.


I'm not so sure about this change to nameToURL().
In the code below, I marked your change with /* Efrat */.

--start--
    /** Given a file or URL name, return as a URL.  If the file name
     *  is relative, then it is interpreted as being relative to the
     *  specified base directory. If the name begins with
     *  "xxxxxxCLASSPATHxxxxxx" or "$CLASSPATH" then search for the
     *  file relative to the classpath.
     *
     *  <p>Note that "xxxxxxCLASSPATHxxxxxx" the value of the globally
     *  defined constant $CLASSPATH available in the Ptolemy II
     *  expression language.  If no file is found, then throw an
     *  exception.
     *
     *  @param name The name of a file or URL.
     *  @param baseDirectory The base directory for relative file names,
     *   or null to specify none.
     *  @param classLoader The class loader to use to locate system
     *   resources, or null to use the system class loader.
     *  @return A URL, or null if no file name or URL has been specified.
     *  @exception IOException If the file cannot be read, or
     *   if the file cannot be represented as a URL (e.g. System.in), or
     *   the name specification cannot be parsed.
     *  @exception MalformedURLException If the
     */
    public static URL nameToURL(String name, URI baseDirectory,
            ClassLoader classLoader) throws IOException {
        if ((name == null) || name.trim().equals("")) {
            return null;
        }

        // If the name begins with "$CLASSPATH", then attempt to
        // open the file relative to the classpath.
        // NOTE: Use the dummy variable constant set up in the constructor.
        if (name.startsWith(_CLASSPATH_VALUE) || name.startsWith("$CLASSPATH")) {
            // Try relative to classpath.
            String classpathKey;

            if (name.startsWith(_CLASSPATH_VALUE)) {
                classpathKey = _CLASSPATH_VALUE;
            } else {
                classpathKey = "$CLASSPATH";
            }

            String trimmedName = name.substring(classpathKey.length() + 1);

            if (classLoader == null) {
                try {
                    // WebStart: We might be in the Swing Event thread, so
                    // Thread.currentThread().getContextClassLoader()
                    // .getResource(entry) probably will not work so we
                    // use a marker class.
                    Class refClass = Class.forName(
                            "ptolemy.kernel.util.NamedObj");
                    classLoader = refClass.getClassLoader();
                } catch (Exception ex) {
                    // IOException constructor does not take a cause
                    IOException ioException = new IOException(
                            "Cannot find file '" + trimmedName
                            + "' in classpath");
                    ioException.initCause(ex);
                    throw ioException;
                }
            }

            // Use Thread.currentThread()... for Web Start.
            URL result = classLoader.getResource(trimmedName);

            if (result == null) {
                new IOException("Cannot find file '" + trimmedName
                        + "' in classpath");
            }

            return result;
        }

        File file = new File(name);

        if (file.isAbsolute()) {
            if (!file.canRead()) {
                // FIXME: This is a hack.
                // Expanding the configuration with Ptolemy II installed
                // in a directory with spaces in the name fails on
                // JAIImageReader because PtolemyII.jpg is passed in
                // to this method as C:\Program%20Files\Ptolemy\...
                file = new File(StringUtilities.substitute(name, "%20", " "));

                if (!file.canRead()) {
                    throw new IOException("Cannot read file '" + name
                            + "' or '"
                            + StringUtilities.substitute(name, "%20", " ") + "'");
                }
            }

            return file.toURL();
        } else {
            // Try relative to the base directory.
            if (baseDirectory != null) {
                // Try to resolve the URI.
                URI newURI;

                try {
                    newURI = baseDirectory.resolve(name);
                } catch (Exception ex) {
                    // FIXME: Another hack
                    // This time, if we try to open some of the JAI
                    // demos that have actors that have defaults FileParameters
                    // like "$PTII/doc/img/PtolemyII.jpg", then resolve()
                    // bombs.
                    String name2 = StringUtilities.substitute(name, "%20", " ");

                    try {
                        newURI = baseDirectory.resolve(name2);
                        name = name2;
                    } catch (Exception ex2) {
                        IOException io = new IOException(
                                "Problem with URI format in '" + name + "'. "
                                + "and '" + name2 + "'"
                                + "This can happen if the file name "
                                + " is not absolute"
                                + " and is not present relative to the directory"
                                + " in which the specified model was read"
                                + " (which was '" + baseDirectory + "')");
                        io.initCause(ex2);
                        throw io;
                    }
                }

                String urlString = newURI.toString();
                try {
/* Efrat */
                    // Adding another '/' for remote execution.
                    urlString = urlString.substring(0,6) + "/"
                        + urlString.substring(6);
                    return new URL(urlString);
                } catch (Exception ex3) {
                    IOException io = new IOException(
                            "Problem with URI format in '" + urlString + "'. "
                            + "This can happen if the '" + urlString
                            + "' is not absolute"
                            + " and is not present relative to the directory"
                            + " in which the specified model was read"
                            + " (which was '" + baseDirectory + "')");
                    io.initCause(ex3);
                    throw io;
                }
            }

            // As a last resort, try an absolute URL.
            return new URL(name);
        }
    }
--end--

The problem is that if I call this method with something like
  nameToURL("doesnotexist", new URI("."), null);
then I get

  java.io.IOException: Problem with URI format in 'doesno/texist'. This can happen if the 'doesno/texist' is not absolute and is not present relative to the directory in which the specified model was read (which was '.')


>From the comment, I would expect to get an exception because the
file cannot be found.

It seems like the code does not work as advertised.
  nameToURL("file://./doesnotexist", null, null);
does not thrown an exception either.

  
BTW - nameToURL is called by actor/parameters/FilePortParameter.java,
data/expr/FileParameter.java and vergil/basiclGraphController.

_Christopher
--------
    
    Hi Christopher,
    
    I made these change to allow remote execution of a workflow from within =
    a web service.=20
    
    The first modification was due to a URI authentication exception when =
    trying to create a file object from a URI on the remote side. The second =
    modification was due to the file protocol requirements to use 3 slashes, =
    'file:///' on the remote side, although it would be probably be a good =
    idea to also make sure first that the url string actually represents the =
    file protocol.=20
    
    I tested these changes with several io actors. Please let me know what =
    you think, and It would be great if these changes could be checked to =
    the CVS tree.
    
    BTW, as of the beginning of this week, we started synchronyzing with the =
    Ptolemy CVS tree. So, from now on any changes to ptolemy files will be =
    directly on most recent versions.
    
    Thanks a lot,
    
    Efrat
      ----- Original Message -----=20
      From: Christopher Brooks=20
      To: Efrat Jaeger=20
      Cc: kepler-dev at ecoinformatics.org=20
      Sent: Friday, April 22, 2005 4:41 PM
      Subject: Re: [kepler-dev] [kepler-cvs] =
    kepler/src/exp/ptolemy/utilFileUtilities.java
    
    
      Hi Efrat,
    
      I saw your checkin of FileUtilities.java into the Kepler tree.
    
      Is there a specific modification you would like to see made to the
      Ptolemy version? =20
    
      It looks like you are adding modify nameToFile() and removing
      file:/ in one location and then adding a second slash in another
      location?   I'm not totally sure what version  of FileUtilities
      you based your changes on.
    
      The reason I ask is because I think the version of FileUtilities.java
      that you checked in does not have my latest changes.  Also, if you
      start keeping a private copy of the file, then you won't see further=20
      changes.  This sort of thing ends up causing support problems.=20
    
      If you would like, I could make changes to FileUtilties.java for you,
      or else give you read/write cvs permission to the ptII tree if you do
      not have it.
    
      I think your changes are:
    
      ***************
      *** 160,168 ****
                      // Try to resolve the base directory.
                      if (base !=3D null) {
                          URI newURI =3D base.resolve(name);
      !                   String urlStr =3D newURI.toString();
      !                   urlStr =3D urlStr.substring(6); //Removing =
    'file:/'
      !                   file =3D new =
    File(StringUtilities.substitute(urlStr, "%20", " "));
                      }
                  }
         =20
      --- 159,165 ----
                    // Try to resolve the base directory.
                    if (base !=3D null) {
                        URI newURI =3D base.resolve(name);
      !                 file =3D new File(newURI);
                    }
                }
       =20
      ***************
      *** 298,306 ****
                          }
         =20
                          try {
      !                   String urlStr =3D newURI.toString();
      !                   urlStr =3D urlStr.substring(0,6) + "/" + =
    urlStr.substring(6); // adding another '/' for remote execution.
      !                       return new URL(urlStr);
                          } catch (IllegalArgumentException ex3) {
                              IOException io =3D new IOException(
                                      "Problem with URI format in '" + name =
    + "'. "
      --- 295,301 ----
                        }
       =20
                        try {
      !                     return newURI.toURL();
                        } catch (IllegalArgumentException ex3) {
                            IOException io =3D new IOException(
                                    "Problem with URI format in '" + name + =
    "'. "
      cxh at maury 167%=20
    
    
      There is this larger issue of when should the Kepler source tree
      start using the latest ptII devel tree.  Since we are moving towards
      a release, now might be a good time to start synchronizing.
    
      Anyway, just curious about this.
    
      _Christopher
    
      --------
    
          jaeger      05/04/22 15:52:04
         =20
            Added:       src/exp/ptolemy/util FileUtilities.java
            Log:
            modified file paths to match both local and remote workflow =
    execcution
           =20
            Revision  Changes    Path
            1.1                  =
    kepler/src/exp/ptolemy/util/FileUtilities.java
           =20
            Index: FileUtilities.java
            =
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
   =
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
   =
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
            /* Utilities used to manipulate files
           =20
            Copyright (c) 2004-2005 The Regents of the University of =
    California.
            All rights reserved.
            Permission is hereby granted, without written agreement and =
    without
            license or royalty fees, to use, copy, modify, and distribute =
    this
            software and its documentation for any purpose, provided that =
    the above
            copyright notice and the following two paragraphs appear in all =
    copies
            of this software.
           =20
            IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY =
    PARTY
            FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL =
    DAMAGES
            ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, =
    EVEN IF
            THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY =
    OF
            SUCH DAMAGE.
           =20
            THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY =
    WARRANTIES,
            INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
            MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE =
    SOFTWARE
            PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
            CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, =
    UPDATES,
            ENHANCEMENTS, OR MODIFICATIONS.
           =20
            PT_COPYRIGHT_VERSION_2
            COPYRIGHTENDKEY
           =20
            */
            package ptolemy.util;
           =20
            import java.io.BufferedInputStream;
            import java.io.BufferedOutputStream;
            import java.io.BufferedReader;
            import java.io.File;
            import java.io.FileOutputStream;
            import java.io.FileWriter;
            import java.io.IOException;
            import java.io.InputStreamReader;
            import java.io.PrintWriter;
            import java.io.Writer;
            import java.net.MalformedURLException;
            import java.net.URI;
            import java.net.URL;
            import java.net.URLDecoder;
           =20
            import ptolemy.kernel.util.IllegalActionException;
           =20
           =20
            =
    /////////////////////////////////////////////////////////////////////////=
    
         /
            //// FileUtilities
           =20
            /**
               A collection of utilities for manipulating files
               These utilities do not depend on any other ptolemy.* =
    packages.
           =20
               @author Christopher Hylands Brooks
               @version $Id: FileUtilities.java,v 1.1 2005/04/22 22:52:04 =
    jaeger Exp=20
         $
               @since Ptolemy II 4.0
               @Pt.ProposedRating Yellow (eal)
               @Pt.AcceptedRating Red (cxh)
            */
            public class FileUtilities {
                /** Instances of this class cannot be created.
                 */
                private FileUtilities() {
                }
           =20
                =
    ///////////////////////////////////////////////////////////////////
                ////                         public methods                  =
      ////
           =20
                /** Copy sourceURL to destinationFile without doing any byte =
    conversi
         on.
                 *  @param sourceURL The source URL
                 *  @param destinationFile The destination File.
                 *  @return true if the file was copied, false if the file =
    was not
                 *  copied because the sourceURL and the destinationFile =
    refer to the
                 *  same file.
                 *  @exception IOException If the source file is not the =
    same as the
                 *  destination file and the destination file does not =
    exist.
                 */
                public static boolean binaryCopyURLToFile(URL sourceURL,
                        File destinationFile) throws IOException {
                    URL destinationURL =3D =
    destinationFile.getCanonicalFile().toURL();
           =20
                    if (sourceURL.sameFile(destinationURL)) {
                        return false;
                    }
           =20
                    // If sourceURL is of the form file:./foo, then we need =
    to try ag
         ain.
                    File sourceFile =3D new File(sourceURL.getFile());
           =20
                    if =
    (sourceFile.getCanonicalFile().toURL().sameFile(destinationURL
         )) {
                        return false;
                    }
           =20
                    BufferedInputStream input =3D null;
                    try {
                    input =3D new =
    BufferedInputStream(sourceURL.openStream());
                    BufferedOutputStream output =3D null;
                    try {
                    output =3D new BufferedOutputStream(
                    new FileOutputStream(destinationFile));
                   =20
                    int c;
                   =20
                    while ((c =3D input.read()) !=3D -1) {
                    output.write(c);
                    }
                    } finally {
                    if (output !=3D null) {
                    try {
                    output.close();
                    } catch (Throwable throwable) {
                    System.out.println("Ignoring failure to
          close stream "
                    + "on " + destinationFi
         le);
                    throwable.printStackTrace();
                    }
                    }  =20
                    }  =20
                    } finally {
                    if (input !=3D null) {
                    try {
                    input.close();
                    } catch (Throwable throwable) {
                    System.out.println("Ignoring failure to close s
         tream "
                    + "on " + sourceURL);
                    throwable.printStackTrace();
                    }
                    }
                   =20
                   =20
                    }
                   =20
                    return true;
                }
           =20
                /** Given a file name or URL, return the file. This method =
    first atte
         mpts
                 *  to directly use the file name to construct the File. If =
    the
                 *  resulting File is not absolute, then it attempts to =
    resolve it
                 *  relative to the specified base directory, if there is =
    one.
                 *  If there is no such base URI, then it simply returns the
                 *  relative File object.
                 *  <p>
                 *  The file need not exist for this method to succeed.  =
    Thus,
                 *  this method can be used to determine whether a file with =
    a given
                 *  name exists, prior to calling openForWriting(), for =
    example.
                 *  @param name The file name or URL.
                 *  @param base The base for relative URLs.
                 *  @return A File, or null if the filename argument is null =
    or
                 *   an empty string.
                 *  @exception IllegalActionException If a parse error =
    occurs
                 *   reading the file name.
                 */
                public static File nameToFile(String name, URI base) {
                    if ((name =3D=3D null) || name.trim().equals("")) {
                        return null;
                    }
           =20
                    File file =3D new File(name);
           =20
                    if (!file.isAbsolute()) {
                        // Try to resolve the base directory.
                        if (base !=3D null) {
                            URI newURI =3D base.resolve(name);
                            String urlStr =3D newURI.toString();
                            urlStr =3D urlStr.substring(6); //Removing =
    'file:/'
                            file =3D new =
    File(StringUtilities.substitute(urlStr, "%20",
          " "));
                        }
                    }
           =20
                    return file;
                }
           =20
                /** Given a file or URL name, return as a URL.  If the file =
    name
                 *  is relative, then it is interpreted as being relative to =
    the
                 *  specified base directory. If the name begins with
                 *  "xxxxxxCLASSPATHxxxxxx" or "$CLASSPATH" then search for =
    the
                 *  file relative to the classpath.
                 *
                 *  <p>Note that "xxxxxxCLASSPATHxxxxxx" the value of the =
    globally
                 *  defined constant $CLASSPATH available in the Ptolemy II
                 *  expression language.  If no file is found, then throw an
                 *  exception.
                 *
                 *  @param name The name of a file or URL.
                 *  @param baseDirectory The base directory for relative =
    file names,
                 *   or null to specify none.
                 *  @param classLoader The class loader to use to locate =
    system
                 *   resources, or null to use the system class loader.
                 *  @return A URL, or null if no file name or URL has been =
    specified.
                 *  @exception IOException If the file cannot be read, or
                 *   if the file cannot be represented as a URL (e.g. =
    System.in), or
                 *   the name specification cannot be parsed.
                 *  @exception MalformedURLException If the
                 */
                public static URL nameToURL(String name, URI baseDirectory,
                        ClassLoader classLoader) throws IOException {
                    if ((name =3D=3D null) || name.trim().equals("")) {
                        return null;
                    }
           =20
                    // If the name begins with "$CLASSPATH", then attempt to
                    // open the file relative to the classpath.
                    // NOTE: Use the dummy variable constant set up in the =
    constructo
         r.
                    if (name.startsWith(_CLASSPATH_VALUE)
                            || name.startsWith("$CLASSPATH") ) {
                        // Try relative to classpath.
           =20
                        String classpathKey;
                        if (name.startsWith(_CLASSPATH_VALUE)) {
                            classpathKey =3D _CLASSPATH_VALUE;
                        } else {=20
                            classpathKey =3D "$CLASSPATH";
                        }
           =20
                        String trimmedName=3D =
    name.substring(classpathKey.length() + 1)
         ;
           =20
                        if (classLoader =3D=3D null) {
                            try {
                                // WebStart: We might be in the Swing Event =
    thread, s
         o
                                // =
    Thread.currentThread().getContextClassLoader()
                                // .getResource(entry) probably will not =
    work so we
                                // use a marker class.
                                Class refClass =3D Class.forName(
                                        "ptolemy.kernel.util.NamedObj");
                                classLoader =3D refClass.getClassLoader();
                            } catch (Exception ex) {
                                // IOException constructor does not take a =
    cause
                                IOException ioException =3D new IOException(
                                        "Cannot find file '" + trimmedName
                                        + "' in classpath");
                                ioException.initCause(ex);
                                throw ioException;
                            }
                        }
           =20
                        // Use Thread.currentThread()... for Web Start.
                        URL result =3D classLoader.getResource(trimmedName);
           =20
                        if (result =3D=3D null) {
                            new IOException("Cannot find file '" + =
    trimmedName
                                    + "' in classpath");
                        }
           =20
                        return result;
                    }
           =20
                    File file =3D new File(name);
           =20
                    if (file.isAbsolute()) {
                        if (!file.canRead()) {
                            // FIXME: This is a hack.
                            // Expanding the configuration with Ptolemy II =
    installed
                            // in a directory with spaces in the name fails =
    on
                            // JAIImageReader because PtolemyII.jpg is =
    passed in
                            // to this method as =
    C:\Program%20Files\Ptolemy\...
                            file =3D new =
    File(StringUtilities.substitute(name, "%20", "
          "));
           =20
                            if (!file.canRead()) {
                                throw new IOException("Cannot read file '" + =
    name
                                        + "' or '"
                                        + StringUtilities.substitute(name, =
    "%20", " "
         )
                                        + "'");
                            }
                        }
           =20
                        return file.toURL();
                    } else {
                        // Try relative to the base directory.
                        if (baseDirectory !=3D null) {
                            // Try to resolve the URI.
                            URI newURI;
           =20
                            try {
                                newURI =3D baseDirectory.resolve(name);
                            } catch (IllegalArgumentException ex) {
                                // FIXME: Another hack
                                // This time, if we try to open some of the =
    JAI
                                // demos that have actors that have defaults =
    FilePara
         meters
                                // like "$PTII/doc/img/PtolemyII.jpg", then =
    resolve()
                                // bombs.
                                String name2 =3D =
    StringUtilities.substitute(name,
                                        "%20", " ");
           =20
                                try {
                                    newURI =3D baseDirectory.resolve(name2);
                                    name =3D name2;
                                } catch (IllegalArgumentException ex2) {
                                    IOException io =3D new IOException(
                                            "Problem with URI format in '" + =
    name + "
         '. "
                                            + "and '" + name2 + "'"
                                            + "This can happen if the file =
    name "
                                            + " is not absolute"
                                            + " and is not present relative =
    to the di
         rectory"
                                            + " in which the specified model =
    was read
         "
                                            + " (which was '" + =
    baseDirectory + "')")
         ;
                                    io.initCause(ex2);
                                    throw io;
                                }
                            }
           =20
                            try {
                            String urlStr =3D newURI.toString();
                            urlStr =3D urlStr.substring(0,6) + "/" + =
    urlStr.substring
         (6); // adding another '/' for remote execution.
                                return new URL(urlStr);
                            } catch (IllegalArgumentException ex3) {
                                IOException io =3D new IOException(
                                        "Problem with URI format in '" + =
    name + "'. "
                                        + "This can happen if the '" + name
                                        + "' is not absolute"
                                        + " and is not present relative to =
    the direct
         ory"
                                        + " in which the specified model was =
    read"
                                        + " (which was '" + baseDirectory + =
    "')");
                                io.initCause(ex3);
                                throw io;
                            }
                        }
           =20
                        // As a last resort, try an absolute URL.
                        return new URL(name);
                    }
                }
           =20
                /** Open the specified file for reading. If the
                 *  specified name is "System.in", then a reader from =
    standard
                 *  in is returned. If the name begins with
                 *  "$CLASSPATH", then search for the file relative to the =
    classpath.
                 *  If the file name is not absolute, the it is assumed
                 *  to be relative to the specified base directory.
                 *  @see #nameToFile(String, URI)
                 *  @param name File name.
                 *  @param base The base URI for relative references.
                 *  @param classLoader The class loader to use for opening =
    files
                 *   relative to the classpath.
                 *  @return A buffered reader.
                 *  @exception IOException If the file cannot be opened.
                 */
                public static BufferedReader openForReading(String name, URI =
    base,
                        ClassLoader classLoader) throws IOException {
                    if (name.trim().equals("System.in")) {
                        if (STD_IN =3D=3D null) {
                            STD_IN =3D new BufferedReader(new =
    InputStreamReader(System.
         in));
                        }
           =20
                        return STD_IN;
                    }
           =20
                    // Not standard input. Try URL mechanism.
                    URL url =3D nameToURL(name, base, classLoader);
           =20
                    if (url =3D=3D null) {
                        throw new IOException("No file name has been =
    specified.");
                    }
           =20
                    return new BufferedReader(new =
    InputStreamReader(url.openStream())
         );
                }
           =20
                /** Open the specified file for writing or appending. If the
                 *  specified name is "System.out", then a writer to =
    standard
                 *  out is returned. If the file does not exist, then
                 *  create it.  If the file name is not absolute, the it is =
    assumed
                 *  to be relative to the specified base directory.
                 *  If permitted, this method will return a Writer that will =
    simply
                 *  overwrite the contents of the file. It is up to the user =
    of this
                 *  method to check whether this is OK (by first calling
                 *  {@link #nameToFile(String, URI)}
                 *  and calling exists() on the returned value).
                 *  @param name File name.
                 *  @param base The base URI for relative references.
                 *  @param append If true, then append to the file rather =
    than
                 *   overwriting.
                 *  @return A writer, or null if no file name is specified.
                 *  @exception IOException If the file cannot be opened
                 *   or created.
                 */
                public static Writer openForWriting(String name, URI base, =
    boolean ap
         pend)
                        throws IOException {
                    if (name =3D=3D null) {
                        return null;  =20
                    }
                    if (name.trim().equals("System.out")) {
                        if (STD_OUT =3D=3D null) {
                            STD_OUT =3D new PrintWriter(System.out);
                        }
           =20
                        return STD_OUT;
                    }
           =20
                    if (name.trim().equals("")) {
                        return null;
                    }
           =20
                    File file =3D nameToFile(name, base);
                    return new FileWriter(file, append);
                }
           =20
                =
    ///////////////////////////////////////////////////////////////////
                ////                         public members                  =
     ////
           =20
                /** Standard in as a reader, which will be non-null
                 *  only after a call to openForReading("System.in").
                 */
                public static BufferedReader STD_IN =3D null;
           =20
                /** Standard out as a writer, which will be non-null
                 *  only after a call to openForWriting("System.out").
                 */
                public static PrintWriter STD_OUT =3D null;
           =20
                =
    ///////////////////////////////////////////////////////////////////
                ////                         private members                 =
      ////
           =20
                /** Tag value used by this class and registered as a parser
                 *  constant for the identifier "CLASSPATH" to indicate =
    searching
                 *  in the classpath.  This is a hack, but it deals with the =
    fact
                 *  that Java is not symmetric in how it deals with getting =
    files
                 *  from the classpath (using getResource) and getting files =
    from
                 *  the file system.
                 */
                private static String _CLASSPATH_VALUE =3D =
    "xxxxxxCLASSPATHxxxxxx";
            }
           =20
           =20
           =20
          _______________________________________________
          Kepler-cvs mailing list
          Kepler-cvs at ecoinformatics.org
          =
    http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-cvs
      --------
      _______________________________________________
      Kepler-dev mailing list
      Kepler-dev at ecoinformatics.org
      =
    http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-dev
    
    ------=_NextPart_000_00B5_01C5479A.0DB664C0
    Content-Type: text/html;
    	charset="iso-8859-1"
    Content-Transfer-Encoding: quoted-printable
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META http-equiv=3DContent-Type content=3D"text/html; =
    charset=3Diso-8859-1">
    <META content=3D"MSHTML 6.00.2800.1458" name=3DGENERATOR>
    <STYLE></STYLE>
    </HEAD>
    <BODY bgColor=3D#ffffff>
    <DIV><FONT face=3DArial size=3D2>Hi Christopher,</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>I made these change to allow remote =
    execution of=20
    a&nbsp;workflow&nbsp;from within&nbsp;a web service. </FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>The first modification was due to a URI =
    
    authentication exception when trying to create a file object from a URI =
    on the=20
    remote side. The second modification was due to the file protocol =
    requirements=20
    to use 3 slashes, 'file:///'&nbsp;on the remote side, although&nbsp;it =
    would be=20
    probably be a good idea to also make sure first that the url string=20
    actually&nbsp;represents the file protocol.&nbsp;</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>I tested these changes with several io =
    actors.=20
    Please let me know what you think, and It would be great if these =
    changes could=20
    be checked to the CVS tree.</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>BTW, as of the beginning of this week,=20
    we&nbsp;started synchronyzing with the Ptolemy CVS tree. So, from now on =
    any=20
    changes to ptolemy files will be directly on most recent =
    versions.</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>Thanks a lot,</FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>Efrat</FONT></DIV>
    <BLOCKQUOTE=20
    style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
    BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
      <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
      <DIV=20
      style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
    black"><B>From:</B>=20
      <A title=3Dcxh at eecs.berkeley.edu =
    href=3D"mailto:cxh at eecs.berkeley.edu">Christopher=20
      Brooks</A> </DIV>
      <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
    title=3Djaeger at ecoinformatics.org=20
      href=3D"mailto:jaeger at ecoinformatics.org">Efrat Jaeger</A> </DIV>
      <DIV style=3D"FONT: 10pt arial"><B>Cc:</B> <A=20
      title=3Dkepler-dev at ecoinformatics.org=20
      =
    href=3D"mailto:kepler-dev at ecoinformatics.org">kepler-dev at ecoinformatics.o=
    rg</A>=20
      </DIV>
      <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Friday, April 22, 2005 =
    4:41=20
    PM</DIV>
      <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: [kepler-dev] =
    [kepler-cvs]=20
      kepler/src/exp/ptolemy/utilFileUtilities.java</DIV>
      <DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial=20
      size=3D2></FONT><BR></DIV>Hi Efrat,<BR><BR>I saw your checkin of=20
      FileUtilities.java into the Kepler tree.<BR><BR>Is there a specific=20
      modification you would like to see made to the<BR>Ptolemy =
    version?&nbsp;=20
      <BR><BR>It looks like you are adding modify nameToFile() and=20
      removing<BR>file:/ in one location and then adding a second slash in=20
      another<BR>location?&nbsp;&nbsp; I'm not totally sure what =
    version&nbsp; of=20
      FileUtilities<BR>you based your changes on.<BR><BR>The reason I ask is =
    because=20
      I think the version of FileUtilities.java<BR>that you checked in does =
    not have=20
      my latest changes.&nbsp; Also, if you<BR>start keeping a private copy =
    of the=20
      file, then you won't see further <BR>changes.&nbsp; This sort of thing =
    ends up=20
      causing support problems. <BR><BR>If you would like, I could make =
    changes to=20
      FileUtilties.java for you,<BR>or else give you read/write cvs =
    permission to=20
      the ptII tree if you do<BR>not have it.<BR><BR>I think your changes=20
      are:<BR><BR>***************<BR>*** 160,168=20
      =
    ****<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;=20
      // Try to resolve the base=20
      =
    directory.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      if (base !=3D null)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      URI newURI =3D=20
      =
    base.resolve(name);<BR>!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      String urlStr =3D=20
      =
    newURI.toString();<BR>!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      urlStr =3D urlStr.substring(6); //Removing=20
      =
    'file:/'<BR>!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      file =3D new File(StringUtilities.substitute(urlStr, "%20", "=20
      =
    "));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp; <BR>--- 159,165=20
      =
    ----<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;=20
      // Try to resolve the base=20
      =
    directory.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;=20
      if (base !=3D null)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      URI newURI =3D=20
      =
    base.resolve(name);<BR>!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      file =3D new=20
      =
    File(newURI);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    }<BR>&nbsp;=20
      <BR>***************<BR>*** 298,306=20
      =
    ****<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      try=20
      =
    {<BR>!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      String urlStr =3D=20
      =
    newURI.toString();<BR>!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      urlStr =3D urlStr.substring(0,6) + "/" + urlStr.substring(6); // =
    adding another=20
      '/' for remote=20
      =
    execution.<BR>!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;=20
      return new=20
      =
    URL(urlStr);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      } catch (IllegalArgumentException ex3)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      IOException io =3D new=20
      =
    IOException(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      "Problem with URI format in '" + name + "'. "<BR>--- 295,301=20
      =
    ----<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      try=20
      =
    {<BR>!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      return=20
      =
    newURI.toURL();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      } catch (IllegalArgumentException ex3)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      IOException io =3D new=20
      =
    IOException(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      "Problem with URI format in '" + name + "'. "<BR><A=20
      href=3D"mailto:cxh at maury">cxh at maury</A> 167% <BR><BR><BR>There is this =
    larger=20
      issue of when should the Kepler source tree<BR>start using the latest =
    ptII=20
      devel tree.&nbsp; Since we are moving towards<BR>a release, now might =
    be a=20
      good time to start synchronizing.<BR><BR>Anyway, just curious about=20
      this.<BR><BR>_Christopher<BR><BR>--------<BR><BR>&nbsp;&nbsp;&nbsp;=20
      jaeger&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 05/04/22 =
    15:52:04<BR>&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    Added:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      src/exp/ptolemy/util =
    FileUtilities.java<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      Log:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; modified file paths to match =
    both local=20
      and remote workflow execcution<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Revision&nbsp; =
    Changes&nbsp;&nbsp;&nbsp;=20
      Path<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    1.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    kepler/src/exp/ptolemy/util/FileUtilities.java<BR>&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Index:=20
      FileUtilities.java<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
   =
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
   =
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR>&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;=20
      /* Utilities used to manipulate =
    files<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Copyright (c) 2004-2005 The Regents =
    of the=20
      University of California.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; All rights =
    
      reserved.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Permission is hereby =
    granted,=20
      without written agreement and =
    without<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      license or royalty fees, to use, copy, modify, and distribute=20
      this<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; software and its documentation =
    for any=20
      purpose, provided that the above<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    copyright=20
      notice and the following two paragraphs appear in all=20
      copies<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; of this=20
      software.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY=20
      PARTY<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FOR DIRECT, INDIRECT, SPECIAL, =
    
      INCIDENTAL, OR CONSEQUENTIAL DAMAGES<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    ARISING=20
      OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN=20
      IF<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; THE UNIVERSITY OF CALIFORNIA HAS =
    BEEN=20
      ADVISED OF THE POSSIBILITY OF<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUCH=20
      DAMAGE.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY=20
      WARRANTIES,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INCLUDING, BUT NOT =
    LIMITED TO,=20
      THE IMPLIED WARRANTIES OF<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    MERCHANTABILITY=20
      AND FITNESS FOR A PARTICULAR PURPOSE. THE=20
      SOFTWARE<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PROVIDED HEREUNDER IS ON AN =
    "AS IS"=20
      BASIS, AND THE UNIVERSITY OF<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    CALIFORNIA HAS=20
      NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,=20
      UPDATES,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENHANCEMENTS, OR=20
      MODIFICATIONS.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      PT_COPYRIGHT_VERSION_2<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      COPYRIGHTENDKEY<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      package ptolemy.util;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import=20
      java.io.BufferedInputStream;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import=20
      java.io.BufferedOutputStream;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import =
    
      java.io.BufferedReader;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import=20
      java.io.File;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import=20
      java.io.FileOutputStream;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import=20
      java.io.FileWriter;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import=20
      java.io.IOException;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import=20
      java.io.InputStreamReader;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import=20
      java.io.PrintWriter;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import=20
      java.io.Writer;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import=20
      java.net.MalformedURLException;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    import=20
      java.net.URI;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import=20
      java.net.URL;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import=20
      java.net.URLDecoder;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import=20
      =
    ptolemy.kernel.util.IllegalActionException;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    /////////////////////////////////////////////////////////////////////////=
    <BR>&nbsp;&nbsp;=20
      /<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ////=20
      FileUtilities<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      /**<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A collection =
    of=20
      utilities for manipulating=20
      files<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; These =
    utilities do=20
      not depend on any other ptolemy.* =
    packages.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @author =
    Christopher=20
      Hylands Brooks<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    @version=20
      $Id: FileUtilities.java,v 1.1 2005/04/22 22:52:04 jaeger Exp =
    <BR>&nbsp;&nbsp;=20
      $<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @since Ptolemy =
    II=20
      4.0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    @Pt.ProposedRating=20
      Yellow (eal)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      @Pt.AcceptedRating Red (cxh)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public class FileUtilities=20
      {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** =
    Instances of=20
      this class cannot be=20
      =
    created.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private=20
      FileUtilities() =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    ///////////////////////////////////////////////////////////////////<BR>&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    ////&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;=20
      public=20
      =
    methods&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      ////<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** Copy =
    sourceURL=20
      to destinationFile without doing any byte conversi<BR>&nbsp;&nbsp;=20
      on.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      @param sourceURL The source=20
      URL<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      @param destinationFile The destination=20
      File.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      @return true if the file was copied, false if the file was=20
      not<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      copied because the sourceURL and the destinationFile refer to=20
      the<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      same =
    file.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp; @exception IOException If the source file is not the same as=20
      the<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      destination file and the destination file does not=20
      exist.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public =
    static=20
      boolean binaryCopyURLToFile(URL=20
      =
    sourceURL,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      File destinationFile) throws IOException=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      URL destinationURL =3D=20
      =
    destinationFile.getCanonicalFile().toURL();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      if (sourceURL.sameFile(destinationURL))=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      return=20
      =
    false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      // If sourceURL is of the form file:./foo, then we need to try=20
      ag<BR>&nbsp;&nbsp;=20
      =
    ain.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;=20
      File sourceFile =3D new=20
      File(sourceURL.getFile());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      if=20
      =
    (sourceFile.getCanonicalFile().toURL().sameFile(destinationURL<BR>&nbsp;&=
    nbsp;=20
      ))=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      return=20
      =
    false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      BufferedInputStream input =3D=20
      =
    null;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;=20
      try=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      input =3D new=20
      =
    BufferedInputStream(sourceURL.openStream());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      BufferedOutputStream output =3D=20
      =
    null;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;=20
      try=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      output =3D new=20
      =
    BufferedOutputStream(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      new=20
      =
    FileOutputStream(destinationFile));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      int=20
      =
    c;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      while ((c =3D input.read()) !=3D -1)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      =
    output.write(c);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      } finally=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      if (output !=3D null)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      try=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      =
    output.close();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;=20
      } catch (Throwable throwable)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      System.out.println("Ignoring failure to<BR>&nbsp;&nbsp;&nbsp; close =
    stream=20
      =
    "<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      + "on " + destinationFi<BR>&nbsp;&nbsp;=20
      =
    le);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;=20
      =
    throwable.printStackTrace();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      }&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      }&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      } finally=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      if (input !=3D null)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      try=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      =
    input.close();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;=20
      } catch (Throwable throwable)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      System.out.println("Ignoring failure to close s<BR>&nbsp;&nbsp; tream=20
      =
    "<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      + "on " +=20
      =
    sourceURL);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;=20
      =
    throwable.printStackTrace();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      =
    }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      =
    }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      return true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** Given a =
    file=20
      name or URL, return the file. This method first atte<BR>&nbsp;&nbsp;=20
      mpts<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      to directly use the file name to construct the File. If=20
      the<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      resulting File is not absolute, then it attempts to resolve=20
      it<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      relative to the specified base directory, if there is=20
      one.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      If there is no such base URI, then it simply returns=20
      the<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      relative File=20
      =
    object.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp;=20
      =
    &lt;p&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    =20
      *&nbsp; The file need not exist for this method to succeed.&nbsp;=20
      Thus,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      this method can be used to determine whether a file with a=20
      given<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      name exists, prior to calling openForWriting(), for=20
      =
    example.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      *&nbsp; @param name The file name or=20
      URL.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      @param base The base for relative=20
      URLs.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      @return A File, or null if the filename argument is null=20
      or<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp;&nbsp; an empty=20
      =
    string.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp; @exception IllegalActionException If a parse error=20
      occurs<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      *&nbsp;&nbsp; reading the file=20
      name.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public =
    static=20
      File nameToFile(String name, URI base)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      if ((name =3D=3D null) || name.trim().equals(""))=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      return=20
      =
    null;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      File file =3D new File(name);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      if (!file.isAbsolute())=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      // Try to resolve the base=20
      =
    directory.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      if (base !=3D null)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      URI newURI =3D=20
      =
    base.resolve(name);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;=20
      String urlStr =3D=20
      =
    newURI.toString();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;=20
      urlStr =3D urlStr.substring(6); //Removing=20
      =
    'file:/'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      file =3D new File(StringUtilities.substitute(urlStr,=20
      "%20",<BR>&nbsp;&nbsp;&nbsp; "=20
      =
    "));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      return file;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** Given a =
    file or=20
      URL name, return as a URL.&nbsp; If the file=20
      name<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      is relative, then it is interpreted as being relative to=20
      the<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      specified base directory. If the name begins=20
      with<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      "xxxxxxCLASSPATHxxxxxx" or "$CLASSPATH" then search for=20
      the<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      file relative to the=20
      =
    classpath.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;=20
      *<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      &lt;p&gt;Note that "xxxxxxCLASSPATHxxxxxx" the value of the=20
      =
    globally<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      *&nbsp; defined constant $CLASSPATH available in the Ptolemy=20
      II<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      expression language.&nbsp; If no file is found, then throw=20
      an<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      =
    exception.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;=20
      *<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      @param name The name of a file or=20
      URL.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      @param baseDirectory The base directory for relative file=20
      names,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      *&nbsp;&nbsp; or null to specify=20
      none.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      @param classLoader The class loader to use to locate=20
      system<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      *&nbsp;&nbsp; resources, or null to use the system class=20
      =
    loader.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp; @return A URL, or null if no file name or URL has been=20
      =
    specified.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;=20
      *&nbsp; @exception IOException If the file cannot be read,=20
      or<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp;&nbsp; if the file cannot be represented as a URL (e.g. =
    System.in),=20
      or<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp;&nbsp; the name specification cannot be=20
      =
    parsed.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp; @exception MalformedURLException If=20
      the<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public =
    static URL=20
      nameToURL(String name, URI=20
      =
    baseDirectory,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      ClassLoader classLoader) throws IOException=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      if ((name =3D=3D null) || name.trim().equals(""))=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      return=20
      =
    null;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      // If the name begins with "$CLASSPATH", then attempt=20
      =
    to<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;=20
      // open the file relative to the=20
      =
    classpath.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;=20
      // NOTE: Use the dummy variable constant set up in the=20
      constructo<BR>&nbsp;&nbsp;=20
      =
    r.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;=20
      if=20
      =
    (name.startsWith(_CLASSPATH_VALUE)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;=20
      || name.startsWith("$CLASSPATH") )=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      // Try relative to classpath.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      String=20
      =
    classpathKey;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      if (name.startsWith(_CLASSPATH_VALUE))=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      classpathKey =3D=20
      =
    _CLASSPATH_VALUE;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      } else {=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      classpathKey =3D=20
      =
    "$CLASSPATH";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      String trimmedName=3D name.substring(classpathKey.length() + =
    1)<BR>&nbsp;&nbsp;=20
      ;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      if (classLoader =3D=3D null)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      try=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      // WebStart: We might be in the Swing Event thread, s<BR>&nbsp;&nbsp;=20
      =
    o<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      //=20
      =
    Thread.currentThread().getContextClassLoader()<BR>&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      // .getResource(entry) probably will not work so=20
      =
    we<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      // use a marker=20
      =
    class.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;=20
      Class refClass =3D=20
      =
    Class.forName(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    "ptolemy.kernel.util.NamedObj");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      classLoader =3D=20
      =
    refClass.getClassLoader();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      } catch (Exception ex)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      // IOException constructor does not take a=20
      =
    cause<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;=20
      IOException ioException =3D new=20
      =
    IOException(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      "Cannot find file '" +=20
      =
    trimmedName<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      + "' in=20
      =
    classpath");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;=20
      =
    ioException.initCause(ex);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      throw=20
      =
    ioException;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      // Use Thread.currentThread()... for Web=20
      =
    Start.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      URL result =3D=20
      =
    classLoader.getResource(trimmedName);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      if (result =3D=3D null)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      new IOException("Cannot find file '" +=20
      =
    trimmedName<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      + "' in=20
      =
    classpath");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      return=20
      =
    result;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      File file =3D new File(name);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      if (file.isAbsolute())=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      if (!file.canRead())=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      // FIXME: This is a=20
      =
    hack.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      // Expanding the configuration with Ptolemy II=20
      =
    installed<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      // in a directory with spaces in the name fails=20
      =
    on<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      // JAIImageReader because PtolemyII.jpg is passed=20
      =
    in<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      // to this method as=20
      =
    C:\Program%20Files\Ptolemy\...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;=20
      file =3D new File(StringUtilities.substitute(name, "%20",=20
      "<BR>&nbsp;&nbsp;&nbsp; "));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      if (!file.canRead())=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      throw new IOException("Cannot read file '" +=20
      =
    name<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      + "' or=20
      =
    '"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      + StringUtilities.substitute(name, "%20", " "<BR>&nbsp;&nbsp;=20
      =
    )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      +=20
      =
    "'");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      return=20
      =
    file.toURL();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;=20
      } else=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      // Try relative to the base=20
      =
    directory.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      if (baseDirectory !=3D null)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      // Try to resolve the=20
      =
    URI.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      URI newURI;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      try=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      newURI =3D=20
      =
    baseDirectory.resolve(name);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;=20
      } catch (IllegalArgumentException ex)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      // FIXME: Another=20
      =
    hack<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;=20
      // This time, if we try to open some of the=20
      =
    JAI<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;=20
      // demos that have actors that have defaults FilePara<BR>&nbsp;&nbsp;=20
      =
    meters<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;=20
      // like "$PTII/doc/img/PtolemyII.jpg", then=20
      =
    resolve()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;=20
      //=20
      =
    bombs.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;=20
      String name2 =3D=20
      =
    StringUtilities.substitute(name,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;=20
      "%20", " ");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;=20
      try=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      newURI =3D=20
      =
    baseDirectory.resolve(name2);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      name =3D=20
      =
    name2;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;=20
      } catch (IllegalArgumentException ex2)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      IOException io =3D new=20
      =
    IOException(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;=20
      "Problem with URI format in '" + name + "<BR>&nbsp;&nbsp; '.=20
      =
    "<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;=20
      + "and '" + name2 +=20
      =
    "'"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      + "This can happen if the file name=20
      =
    "<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;=20
      + " is not=20
      =
    absolute"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;=20
      + " and is not present relative to the di<BR>&nbsp;&nbsp;=20
      =
    rectory"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;=20
      + " in which the specified model was read<BR>&nbsp;&nbsp;=20
      =
    "<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;=20
      + " (which was '" + baseDirectory + "')")<BR>&nbsp;&nbsp;=20
      =
    ;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    io.initCause(ex2);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      throw=20
      =
    io;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;=20
      =
    }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      try=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      String urlStr =3D=20
      =
    newURI.toString();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;=20
      urlStr =3D urlStr.substring(0,6) + "/" + =
    urlStr.substring<BR>&nbsp;&nbsp; (6);=20
      // adding another '/' for remote=20
      =
    execution.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;=20
      return new=20
      =
    URL(urlStr);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      } catch (IllegalArgumentException ex3)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      IOException io =3D new=20
      =
    IOException(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      "Problem with URI format in '" + name + "'.=20
      =
    "<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      + "This can happen if the '" +=20
      =
    name<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      + "' is not=20
      =
    absolute"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      + " and is not present relative to the direct<BR>&nbsp;&nbsp;=20
      =
    ory"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      + " in which the specified model was=20
      =
    read"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      + " (which was '" + baseDirectory +=20
      =
    "')");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;=20
      =
    io.initCause(ex3);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;=20
      throw=20
      =
    io;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      // As a last resort, try an absolute=20
      =
    URL.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      return new=20
      =
    URL(name);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** Open =
    the=20
      specified file for reading. If=20
      the<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      specified name is "System.in", then a reader from=20
      =
    standard<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      *&nbsp; in is returned. If the name begins=20
      with<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      "$CLASSPATH", then search for the file relative to the=20
      =
    classpath.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;=20
      *&nbsp; If the file name is not absolute, the it is=20
      =
    assumed<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp; to be relative to the specified base=20
      =
    directory.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;=20
      *&nbsp; @see #nameToFile(String,=20
      URI)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      @param name File=20
      name.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      @param base The base URI for relative=20
      =
    references.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;=20
      *&nbsp; @param classLoader The class loader to use for opening=20
      files<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp;&nbsp; relative to the=20
      =
    classpath.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;=20
      *&nbsp; @return A buffered=20
      =
    reader.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp; @exception IOException If the file cannot be=20
      =
    opened.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public =
    static=20
      BufferedReader openForReading(String name, URI=20
      =
    base,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      ClassLoader classLoader) throws IOException=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      if (name.trim().equals("System.in"))=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      if (STD_IN =3D=3D null)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      STD_IN =3D new BufferedReader(new =
    InputStreamReader(System.<BR>&nbsp;&nbsp;=20
      =
    in));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      return=20
      =
    STD_IN;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      // Not standard input. Try URL=20
      =
    mechanism.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;=20
      URL url =3D nameToURL(name, base,=20
      classLoader);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      if (url =3D=3D null)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      throw new IOException("No file name has been=20
      =
    specified.");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      return new BufferedReader(new=20
      InputStreamReader(url.openStream())<BR>&nbsp;&nbsp;=20
      );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** Open =
    the=20
      specified file for writing or appending. If=20
      the<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      specified name is "System.out", then a writer to=20
      =
    standard<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      *&nbsp; out is returned. If the file does not exist,=20
      then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      create it.&nbsp; If the file name is not absolute, the it is=20
      =
    assumed<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp; to be relative to the specified base=20
      =
    directory.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;=20
      *&nbsp; If permitted, this method will return a Writer that will=20
      simply<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      overwrite the contents of the file. It is up to the user of=20
      this<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      method to check whether this is OK (by first=20
      =
    calling<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp; <A href=3D"mailto:{@link">{@link</A> #nameToFile(String,=20
      URI)}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      and calling exists() on the returned=20
      =
    value).<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp; @param name File=20
      name.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      @param base The base URI for relative=20
      =
    references.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;=20
      *&nbsp; @param append If true, then append to the file rather=20
      than<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      *&nbsp;&nbsp;=20
      =
    overwriting.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;=20
      *&nbsp; @return A writer, or null if no file name is=20
      =
    specified.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;=20
      *&nbsp; @exception IOException If the file cannot be=20
      opened<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      *&nbsp;&nbsp; or=20
      =
    created.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public =
    static=20
      Writer openForWriting(String name, URI base, boolean =
    ap<BR>&nbsp;&nbsp;=20
      =
    pend)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      throws IOException=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      if (name =3D=3D null)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      return null;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      =
    }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;=20
      if (name.trim().equals("System.out"))=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      if (STD_OUT =3D=3D null)=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      STD_OUT =3D new=20
      =
    PrintWriter(System.out);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      return=20
      =
    STD_OUT;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
    nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      if (name.trim().equals(""))=20
      =
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      return=20
      =
    null;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;=20
      File file =3D nameToFile(name,=20
      =
    base);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;=20
      return new FileWriter(file,=20
      append);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    ///////////////////////////////////////////////////////////////////<BR>&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    ////&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;=20
      public=20
      =
    members&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      ////<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** =
    Standard in as=20
      a reader, which will be=20
      =
    non-null<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      *&nbsp; only after a call to=20
      =
    openForReading("System.in").<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
    ;&nbsp;&nbsp;&nbsp;=20
      */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public =
    static=20
      BufferedReader STD_IN =3D null;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** =
    Standard out as=20
      a writer, which will be=20
      =
    non-null<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      *&nbsp; only after a call to=20
      =
    openForWriting("System.out").<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;&nbsp;&nbsp;&nbsp;=20
      */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public =
    static=20
      PrintWriter STD_OUT =3D null;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    ///////////////////////////////////////////////////////////////////<BR>&n=
    bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      =
    ////&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
    sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
    p;=20
      private=20
      =
    members&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      ////<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /** Tag =
    value used=20
      by this class and registered as a=20
      parser<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      constant for the identifier "CLASSPATH" to indicate=20
      =
    searching<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
    =20
      *&nbsp; in the classpath.&nbsp; This is a hack, but it deals with the=20
      fact<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      that Java is not symmetric in how it deals with getting=20
      files<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      from the classpath (using getResource) and getting files=20
      from<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    *&nbsp;=20
      the file=20
      =
    system.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private =
    static=20
      String _CLASSPATH_VALUE =3D=20
      "xxxxxxCLASSPATHxxxxxx";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
    
      <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;=20
      _______________________________________________<BR>&nbsp;&nbsp;&nbsp;=20
      Kepler-cvs mailing list<BR>&nbsp;&nbsp;&nbsp; <A=20
      =
    href=3D"mailto:Kepler-cvs at ecoinformatics.org">Kepler-cvs at ecoinformatics.o=
    rg</A><BR>&nbsp;&nbsp;&nbsp;=20
      <A=20
      =
    href=3D"http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kep=
    ler-cvs">http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/ke=
    pler-cvs</A><BR>--------<BR>_____________________________________________=
    __<BR>Kepler-dev=20
      mailing list<BR><A=20
      =
    href=3D"mailto:Kepler-dev at ecoinformatics.org">Kepler-dev at ecoinformatics.o=
    rg</A><BR><A=20
      =
    href=3D"http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kep=
    ler-dev">http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/ke=
    pler-dev</A><BR></BLOCKQUOTE></BODY></HTML>
    
    ------=_NextPart_000_00B5_01C5479A.0DB664C0--
--------


More information about the Kepler-dev mailing list