package org.jeecg.modules.warning.common;

import java.io.*;

/**
 * 应产品经理需求
 * 要求预警模型数据写文件处理
 */
public class FileUtil {

    public static String read(){
        try {
            BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("e:\\JAR\\color.txt"), "UTF-8"));
//            BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("d:\\code\\color.txt"), "UTF-8"));
            return  in.readLine();
        }catch (Exception e){
            return "";
        }
    }

    public static Boolean write(String str) {
        try {
            //写入相应的文件
            BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("e:\\JAR\\color.txt"), "UTF-8"));
//            BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("d:\\code\\color.txt"), "UTF-8"));
            out.write(str);
            //清楚缓存
            out.flush();
            out.close();
        } catch (Exception e) {
            return false;
        }
        return true;
    }

}
