001package ca.bc.webarts.applets.menu;
002
003import java.io.*;
004import java.util.*;
005
006
007/**
008 *  Propertiesobject for Menu Applet.
009 *
010 * @author     tgutwin
011 * @created    October 18, 2002
012 */
013public class PropertiesMenu extends Properties
014{
015
016  /**
017   *  Description of the Method
018   *
019   * @param  inputstream      Description of the Parameter
020   * @exception  IOException  Description of the Exception
021   */
022  public synchronized void load(InputStream inputstream)
023    throws IOException
024  {
025    BufferedReader bufferedreader
026         = new BufferedReader(new InputStreamReader(inputstream, "8859_1"));
027    for (; ; )
028    {
029      String string = bufferedreader.readLine();
030      if (string == null)
031      {
032        break;
033      }
034      if (string.length() > 0 && string.charAt(0) != '#'
035           && string.charAt(0) != '!')
036      {
037        String[] strings = tokenString(string, "=");
038        if (strings.length == 2)
039        {
040          String string_1_ = strings[0].trim();
041          String string_2_ = strings[1].trim();
042          this.put(string_1_, string_2_);
043        }
044      }
045    }
046  }
047
048
049  /**
050   *  Description of the Method
051   *
052   * @param  string     Description of the Parameter
053   * @param  string_0_  Description of the Parameter
054   * @return            Description of the Return Value
055   */
056  private String[] tokenString(String string, String string_0_)
057  {
058    StringTokenizer stringtokenizer
059         = new StringTokenizer(string, string_0_);
060    String[] strings = new String[stringtokenizer.countTokens()];
061    for (int i = 0; i < strings.length; i++)
062    {
063      strings[i] = stringtokenizer.nextToken();
064    }
065    return strings;
066  }
067}
068