将文件写到磁盘

public class FileUtils {
    
    private static final Logger logger = LoggerFactory.getLogger(FileUtils.class);
    /**
     * 
     * @param message
     * @param topath
     * @param fileName
     * @throws IOException
     */
    public static void storeMessageInDisk(String message, String topath, String fileName) throws IOException {
        logger.info("enter into  FileUtils --> storeMessageInDisk method ");

        File file = new File(topath);
        if (!file.exists()) {
            file.mkdirs();
        }
        File EDIMessage1 = new File(topath + fileName);
        FileWriter fwin = new FileWriter(EDIMessage1);
        fwin.write(message);
        fwin.close();
        
        
        

        logger.info("end the  FileUtils --> storeMessageInDisk method ");
    }

}

猜你喜欢

转载自www.cnblogs.com/lshan/p/10008747.html