dotty.tools.dottydoc.staticsite.Yaml Maven / Gradle / Ivy
package dotty.tools.dottydoc.staticsite;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.type.TypeReference;
import java.util.HashMap;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
public class Yaml {
public static HashMap apply(String input)
throws java.io.UnsupportedEncodingException, java.io.IOException {
ByteArrayInputStream is = new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8));
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
TypeReference> typeRef =
new TypeReference>() {};
return mapper.readValue(is, typeRef);
}
}