package com.yeejoin.amos.boot.module.jyjc.biz.util;


import org.springframework.core.io.ClassPathResource;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class DpSubUtils {

    public static String companyJson = null;
    public static String textJson = null;
    public static String imageJson = null;
    public static String circleJson = null;
    public static String rectJson = null;

    static {
//        companyJson = getFileContent("company.json");
//        textJson = getFileContent("text.json");
//        imageJson = getFileContent("image.json");
//        circleJson = getFileContent("circle.json");
//        rectJson = getFileContent("rect.json");
    }

    public static String getFileContent(String filename){
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(new ClassPathResource("json/"+filename).getInputStream()));
            StringBuffer sb = new StringBuffer();
            String line = null;
            while((line = br.readLine())!=null){
                if(line.trim().length()>0)
                    sb.append(line);
            }
            br.close();
            return sb.toString();
        } catch (Exception e) {
            throw new RuntimeException(e);
//			return null;
        }
    }
}
