package com.rf.psychological.scalesJNI;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.rf.psychological.scale.resultBusiness.scaleResult.BaseScale;

public class ScalesJNI extends BaseScale {

    public ScalesJNI(JSONArray jsonArray, JSONObject resultJson) {
        super(jsonArray, resultJson);
    }

    public native String commonScale(String jsonArray, String resultJson);
    /*native int get2();

    public String readFile(String file) throws IOException {
        BufferedReader reader = new BufferedReader(new FileReader(file));

        String line = null;

        StringBuilder stringBuilder = new StringBuilder();

        String ls = System.getProperty("line.separator");

        try {
            while((line = reader.readLine()) != null) {
                stringBuilder.append(line);

                stringBuilder.append(ls);

            }

            return stringBuilder.toString();

        } finally {
            reader.close();

        }

    }

    public static void main(String[] args) {
        // 自定义路径使用
        System.load("D:\\softWare\\ideaWorkspace\\psychological\\src\\main\\resources\\scalesDll\\MyDll.dll");
        //System.loadLibrary("MyDll");
        ScalesJNI jni = new ScalesJNI(new JSONArray(),new JSONObject());

        String s1 = null;
        String s2 = null;
        try {
            s1 = jni.readFile("D:\\cpp\\scales\\jsonArray.json");
            //System.out.println(s1);
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            s2 = jni.readFile("D:\\cpp\\scales\\resultJson.json");
        } catch (IOException e) {
            e.printStackTrace();
        }
        System.out.println("kk: " + jni.get2());
        System.out.println("返回的结果：" + jni.commonScale(s1, s2));
    }*/
}
