class YamlParser extends ComponentSupport {

  public Map<String, Object> load(InputStream is) throws IOException {
    checkNotNull(is);
    String data = IOUtils.toString(new UnicodeReader(is));

    Map<String, Object> map;

    try {
      Yaml yaml = new Yaml(new SafeConstructor());
      map = yaml.load(data);
    }
    catch (YAMLException e) {
      map = (Map<String, Object>) mapper.readValue(data, Map.class);
    }
    return map;
  }

}