All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.litongjava.utils.json.fastjson.FastJsonUtils Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
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