Example #1
0
  void loadFromFile() {
    SimpleFile oFile = null;
    try {
      oFile = RhoClassFactory.createFile();
      oFile.open(getConfFilePath(), true, false);

      if (oFile.isOpened()) {
        String strSettings = oFile.readString();
        oFile.close();
        loadFromString(strSettings);
      }

    } catch (Exception exc) {
      if (oFile != null)
        try {
          oFile.close();
        } catch (IOException exc2) {
        }
    }
  }
Example #2
0
  private void loadFromJar() {
    java.io.InputStream fstream = null;
    try {
      fstream = RhoClassFactory.createFile().getResourceAsStream(getClass(), "/" + CONF_FILENAME);
    } catch (Exception e) {
      e.printStackTrace();
    }

    if (fstream == null) return;

    try {
      byte[] data = new byte[fstream.available()];
      int len = fstream.read(data);
      if (len == 0) return;

      String strSettings = new String(data, 0, len);
      loadFromString(strSettings);
    } catch (java.io.IOException exc) {

    }
  }