private InputStream getInputStream(String resourceName) throws IOException {

    // Try class loader to get resource
    ClassLoader cl = GempakParameterTable.class.getClassLoader();
    InputStream s = cl.getResourceAsStream(resourceName);
    if (s != null) {
      return s;
    }

    //Try the file system
    File f = new File(resourceName);
    if (f.exists()) {
        s = new FileInputStream(f);
    }
    if (s != null) {
      return s;
    }

    //Try it as a url
    Matcher m = Pattern.compile(" ").matcher(resourceName);
    String encodedUrl = m.replaceAll("%20");
    URL dataUrl = new URL(encodedUrl);
    URLConnection connection = dataUrl.openConnection();
    return connection.getInputStream();
  }
private InputStream getInputStream(String resourceName) throws IOException {

    
    ClassLoader cl = GempakParameterTable.class.getClassLoader();
    InputStream s = cl.getResourceAsStream(resourceName);
    if (s != null) {
      return s;
    }

    
    File f = new File(resourceName);
    if (f.exists()) {
        s = new FileInputStream(f);
    }
    if (s != null) {
      return s;
    }

    
    Matcher m = Pattern.compile(" ").matcher(resourceName);
    String encodedUrl = m.replaceAll("%20");
    URL dataUrl = new URL(encodedUrl);
    URLConnection connection = dataUrl.openConnection();
    return connection.getInputStream();
  }
private InputStream getInputStream ( String resourceName ) throws IOException { // Try class loader to get resource
 ClassLoader cl = GempakParameterTable . class . getClassLoader ( ) ; InputStream s = cl . getResourceAsStream ( resourceName ) ; if ( s != null ) { return s ; } //Try the file system
 File f = new File ( resourceName ) ; if ( f . exists ( ) ) { s = new FileInputStream ( f ) ; } if ( s != null ) { return s ; } //Try it as a url
 Matcher m = Pattern . compile ( " " ) . matcher ( resourceName ) ; String encodedUrl = m . replaceAll ( "%20" ) ; URL dataUrl = new URL ( encodedUrl ) ; URLConnection connection = dataUrl . openConnection ( ) ; return connection . getInputStream ( ) ; }
Get the input stream to the given resource

@param resourceName The resource name. May be a file, url,
java resource, etc.
@return The input stream to the resource
Get the input stream to the given resource