corba/src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/cff/FileLocator.java
changeset 37822 8b86795b49d4
parent 25862 a5e25d68f971
equal deleted inserted replaced
37761:82b8d12a553f 37822:8b86795b49d4
   220 
   220 
   221     }
   221     }
   222 
   222 
   223     /**
   223     /**
   224      * locateFileInClassPath returns a DataInputStream that can be used
   224      * locateFileInClassPath returns a DataInputStream that can be used
   225      * to read the requested file.  The CLASSPATH is used to locate the file.
   225      * to read the requested file.  The resource is located in the java.corba
       
   226      * module or if not found, then the CLASSPATH is searched.
   226      *
   227      *
   227      * @param fileName The name of the file to locate.  The file name
   228      * @param fileName The name of the file to locate.  The file name
   228      * may be qualified with a partial path name, using '/' as the separator
   229      * may be qualified with a partial path name, using '/' as the separator
   229      * character or using separator characters appropriate for the host file
   230      * character or using separator characters appropriate for the host file
   230      * system, in which case each directory or zip file in the CLASSPATH will
   231      * system, in which case each directory or zip file in the CLASSPATH will
   235      * @exception java.io.IOException The requested class file
   236      * @exception java.io.IOException The requested class file
   236      * could not be opened.
   237      * could not be opened.
   237      */
   238      */
   238     public static DataInputStream locateFileInClassPath (String fileName)
   239     public static DataInputStream locateFileInClassPath (String fileName)
   239         throws FileNotFoundException, IOException {
   240         throws FileNotFoundException, IOException {
       
   241 
       
   242         // The resource should be in the java.corba module
       
   243         InputStream in = FileLocator.class.getResourceAsStream("/" + fileName);
       
   244         if (in != null) {
       
   245             return new DataInputStream(in);
       
   246         }
   240 
   247 
   241         boolean notFound = true;
   248         boolean notFound = true;
   242         StringTokenizer st;
   249         StringTokenizer st;
   243         String path = "";
   250         String path = "";
   244         File cf = null;
   251         File cf = null;