static public XMLStore createFromResource ( String resourceName , XMLStore storedDefaults ) throws java . io . IOException { // open files if exist Class c = XMLStore . class ; InputStream primIS = c . getResourceAsStream ( resourceName ) ; InputStream objIS = c . getResourceAsStream ( resourceName ) ; // debug // InputStream debugIS = c.getResourceAsStream(fileName); // System.out.println("Resource stream= "+fileName); //thredds.util.IO.copy(debugIS, System.out); if ( primIS == null ) { //System.out.println("classLoader="+new XMLStore().getClass().getClassLoader()); throw new java . io . IOException ( "XMLStore.createFromResource cant find <" + resourceName + ">" ) ; } if ( debugWhichStore ) System . out . println ( "XMLStore read from resource " + resourceName ) ; return new XMLStore ( primIS , objIS , storedDefaults ) ; }
Create a read - only XMLStore reading from the specified resource opened as a Resource stream using the XMLStore ClassLoader . This allows you to find files that are in jar files on the application CLASSPATH .