/**
   * Reads news from a text file.
   *
   * @param position a constant indicating which file (top or side) should be read in.
   */
  public static String readNewsFile(String newsFile) {
    String fileName = getNewsFilePath();

    fileName += newsFile;

    String text = "";

    try {
      // retrieve existing news from file
      FileInputStream fir = new FileInputStream(fileName);
      InputStreamReader ir = new InputStreamReader(fir, "UTF-8");
      BufferedReader br = new BufferedReader(ir);

      String lineIn;

      while ((lineIn = br.readLine()) != null) {
        text += lineIn;
      }

      br.close();
    } catch (IOException e) {
      warn("news_read: " + e.getLocalizedMessage());
    }

    return text;
  }
  /**
   * Writes license to a text file.
   *
   * @param news the text to be written to the file.
   */
  public static void writeLicenseFile(String newLicense) {
    String licenseFile =
        getProperty("dspace.dir") + File.separator + "config" + File.separator + "default.license";

    try {
      // write the news out to the appropriate file
      FileOutputStream fos = new FileOutputStream(licenseFile);
      OutputStreamWriter osr = new OutputStreamWriter(fos, "UTF-8");
      PrintWriter out = new PrintWriter(osr);
      out.print(newLicense);
      out.close();
    } catch (IOException e) {
      warn("license_write: " + e.getLocalizedMessage());
    }

    license = newLicense;
  }
  /**
   * Writes news to a text file.
   *
   * @param position a constant indicating which file (top or side) should be written to.
   * @param news the text to be written to the file.
   */
  public static String writeNewsFile(String newsFile, String news) {
    String fileName = getNewsFilePath();

    fileName += newsFile;

    try {
      // write the news out to the appropriate file
      FileOutputStream fos = new FileOutputStream(fileName);
      OutputStreamWriter osr = new OutputStreamWriter(fos, "UTF-8");
      PrintWriter out = new PrintWriter(osr);
      out.print(news);
      out.close();
    } catch (IOException e) {
      warn("news_write: " + e.getLocalizedMessage());
    }

    return news;
  }
  public static long getLongProperty(String property) {
    if (properties == null) {
      loadConfig(null);
    }

    String stringValue = properties.getProperty(property);
    long longValue = 0;

    if (stringValue != null) {
      try {
        longValue = Long.parseLong(stringValue.trim());
      } catch (NumberFormatException e) {
        warn("Warning: Number format long error in property: " + property);
      }
    }

    return longValue;
  }
  /**
   * Get a configuration property as an integer
   *
   * @param property the name of the property
   * @return the value of the property. <code>0</code> is returned if the property does not exist.
   *     To differentiate between this case and when the property actually is zero, use <code>
   *     getProperty</code>.
   */
  public static int getIntProperty(String property) {
    if (properties == null) {
      loadConfig(null);
    }

    String stringValue = properties.getProperty(property);
    int intValue = 0;

    if (stringValue != null) {
      try {
        intValue = Integer.parseInt(stringValue.trim());
      } catch (NumberFormatException e) {
        warn("Warning: Number format error in property: " + property);
      }
    }

    return intValue;
  }