Пример #1
0
 public void Load(BufferedReader propertyInputStream)
 {
   // todo
 }
Пример #2
0
    //  /**
    //   * Returns the folder this program is executed in.
    //   * <p>
    //   * Example: /home/games/JSoko/
    //   *
    //   * @return <code>String</code> containing the path to the folder this program is executed in.
    //   */
    //  public static String getBaseFolder() {
    //    if(baseFolder == null) {
    //      try {
    //        // Get folder of the JSoko.jar.
    //        baseFolder = ClassLoader.getSystemResource(".").toString();

    //        String s = JSoko.class.getClassLoader().getResource("settings.ini").getPath();
    //        if(s != null) {
    //          baseFolder = s.split("settings.ini")[0];
    //        }

    //        // Transform %20 to spaces.
    //        baseFolder = new URI(baseFolder).getPath();

    //      } catch (URISyntaxException e) {
    //        e.printStackTrace();
    //      }
    //    }

    //    return baseFolder;
    //  }

    //  /**
    //   * Returns a <code>InputStream</code> to the file corresponding to the passed filename.
    //   *
    //   * @param filename  the name of the file
    //   * @return the <code>InputStream</code> to the file corresponding to the passed filename
    //   */
    //  public static InputStream getInputStream(String filename) {

    //    InputStream inputStream = null;

    //    // Try to read the file, no matter if it is in the class path or not.
    //    try {
    //      inputStream = new FileInputStream(filename);
    //    } catch (FileNotFoundException e1) {}

    //    // If the program is started as web start application the file may be
    //    // in the jar file. Hence try to read it from the jar, too.
    //    try {
    //      if(inputStream == null) {
    //        inputStream = JSoko.class.getResourceAsStream(filename);
    //      }
    //    } catch (Exception e) {}

    //    return inputStream;
    //  }

    /// <summary>
    /// Returns a <code>BufferedReader</code> to the file corresponding to the passed filename.
    /// 
    /// This method also searches for the file in the class path.
    /// </summary>
    /// <param name="filename">the name of the file</param>
    /// <returns>the <code>BufferedReader</code> to the file corresponding to the passed filename</returns>
    public static BufferedReader GetBufferedReader(string filename)
    {
      BufferedReader b = null;

      // Try to read the file, no matter if it is in the class path or not.
      try
      {
        b = new BufferedReader(File.OpenRead(filename));
      }
      catch (Exception)
      {
        // ignored
      }

      //if (b == null)
      //{
      //  // If the program is started as web start application the file
      //  // may be in the jar file. Hence try to read it from the jar, too.
      //  try
      //  {
      //    b = new BufferedReader(new InputStreamReader(JSoko.classs.getResourceAsStream(filename)));
      //  }
      //  catch (Exception e) { }
      //}
      return b;
    }