package kr.co.swh.lecture.opensource.yaml;


import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.yaml.snakeyaml.Yaml;


/**
 * <pre>
 * 패키지명 : kr.co.swh.lecture.opensource.yaml
 * 파일명 : FileWrite.java
 * 설명 : FileWrite
 * 
 * </pre>
 * 
 * @since : 2022. 4. 27.
 * @author : tobby48
 * @version : v1.0
 */
public class FileWrite {

	public static void main(String[] args){
		Map<String, Object> car = new HashMap<String, Object>();
		car.put("big", new String[] { "BMW", "그렌저" });
		car.put("middle", "소나타");
		
		Map<String, Object> data = new HashMap<String, Object>();
		data.put("cars", car);
		data.put("messenger", "디스코드");
		data.put("sites", new String[] { "네이버", "구글" });
		Yaml yaml = new Yaml();
		FileWriter writer;
		try {
			writer = new FileWriter("samples.yml");
			yaml.dump(data, writer);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
