com.litongjava.utils.json.fastjson.FastJsonUtils Maven / Gradle / Ivy
package com.litongjava.utils.json.fastjson;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import com.alibaba.fastjson.JSON;
public class FastJsonUtils {
/**
* 写入文件
*
* @param filename
* @param object
* @throws IOException
*/
public static void writeToFile(String filename, Object object) throws IOException {
File file = new File(filename);
try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file));) {
JSON.writeJSONString(bufferedWriter, object);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy