code: public static InputStream openInputStreamForFile(String _fileNameWithPath, SearchOrder... _searchOrder) {
          if (_searchOrder == null) {
              return null;
          }
          try {
              for (SearchOrder searchOrder : _searchOrder) {
                  switch (searchOrder) {
                  case CLASS_PATH:
                      InputStream inputStream = FileIoUtil.class.getClassLoader().getResourceAsStream(_fileNameWithPath);
                      if (inputStream != null) {
                          return inputStream;
                      }
                      break;
                  case SYSTEM_PATH:
                      String pathes = System.getenv("PATH");
                      String os = System.getProperty("os.name");
                      String delimiter = ":";
                      if (os != null && os.equalsIgnoreCase("windows")) {
                          delimiter = ";";
                      }
                      if (pathes != null) {
                          String[] searchPathes = pathes.split(delimiter);
                          for (String path : searchPathes) {
                              File file = new File(path, _fileNameWithPath);
                              if (file.exists() && file.canRead()) {
                                  return new FileInputStream(file);
                              }
                          }
                      }
                      break;
                  case CUSTOM_PATH:
                  default:
                      File file = new File(_fileNameWithPath);
                      if (file.exists() && file.canRead()) {
                          return new FileInputStream(file);
                      }
                      break;
                  }
              }
          } catch (FileNotFoundException _ex) {
              return null;
          }
  
          return null;
      }
docs: Tries to find _fileNameWithPath in either classpath, systempath or absolute path and opens an {@link InputStream} for it.
  Search order is specified by {@link SearchOrder} varargs.
  
  @param _fileNameWithPath
  @param _searchOrder
  @return InputStream for the file or null if file could not be found