예제 #1
0
  public void initLoader() {
    BufferedReader reader =
        new BufferedReader(
            new InputStreamReader(
                ResourceLoader.getResourceAsStream(Props.getPropStr("Resource.Picture.Path"))));
    try {
      String line;
      while ((line = reader.readLine()) != null) {
        line = line.trim();

        if (line == null || line.isEmpty() || line.startsWith("#")) {
          continue;
        }
        String[] args = line.split(";");
        String key = args[0].trim();
        String path = args[1].trim();
        try {
          images.put(key, new Image(ResourceLoader.getResourceAsStream(path), path, false));
        } catch (SlickException ex) {
          LOGGER.log(Level.WARNING, "Unable to create image " + path, ex);
        }
      }
    } catch (IOException ex) {
      LOGGER.log(Level.SEVERE, "Unable to initialise the picture loader", ex);
    }
  }