package javakurs.uebung06;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;

/**
 * {@link SimpleProperties} is a basic implementation of the
 * {@link PropertiesIF} interface that just delegates all calls to the embedded
 * properties object.
 *
 * @author Joerg Steffen, DFKI
 * @version $Id$
 */
public class SimpleProperties implements PropertiesIF {

  /**
   * This contains the properties.
   */
  private Properties props;


  /**
   * This creates a new instance of {@link SimpleProperties}.
   */
  public SimpleProperties() {

    this.props = new Properties();
  }


  /**
   * {@inheritDoc}
   */
  @Override
  public String getProperty(String key) {

    return this.props.getProperty(key);
  }


  /**
   * {@inheritDoc}
   */
  @Override
  public Object setProperty(String key, String value) {

    return this.props.setProperty(key, value);
  }


  /**
   * {@inheritDoc}
   */
  @Override
  public void list(PrintStream out) {

    this.props.list(out);
  }


  /**
   * {@inheritDoc}
   */
  @Override
  public Set<Entry<Object, Object>> entrySet() {

    return this.props.entrySet();
  }


  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isEmpty() {

    return this.props.isEmpty();
  }


  /**
   * {@inheritDoc}
   */
  @Override
  public int size() {

    return this.props.size();
  }


  /**
   * {@inheritDoc}
   */
  @Override
  public void loadFromXML(InputStream in)
      throws IOException {

    this.props.loadFromXML(in);
  }


  /**
   * {@inheritDoc}
   */
  @Override
  public void storeToXML(OutputStream os, String comment)
      throws IOException {

    this.props.storeToXML(os, comment);
  }
}
