package wa.server.util;

import java.io.File;
import java.io.IOException;

import wa.server.WAConstants;
import zutil.io.file.FileUtil;

public class ConfigFileUtil {
	
	public static void writeBetweenBoundary(File file, String commentChar, String data) throws IOException{
		String boundary = new StringBuilder().
				append(commentChar).
				append(WAConstants.WA_CONFIG_BOUNDARY).
				append(commentChar).toString();
		String dataWithComment = new StringBuilder().
				append(commentChar).append(" This is auto generated configuration please\n").
				append(commentChar).append(" do not edit this as it will be overwritten\n").
				append(data).toString();
		
		FileUtil.writeBetweenBoundary(file, boundary, dataWithComment);
	}
}
