集册 Java实例教程 编写UTF的助手函数

编写UTF的助手函数

欢马劈雪     最近更新时间:2020-01-02 10:19:05

529
编写UTF-8文件的辅助功能


//package com.nowjava;/**来自 nowjava - 时  代  Java**/

import java.io.FileNotFoundException;

import java.io.PrintWriter;

import java.io.UnsupportedEncodingException;


public class Main {

    /**

     * Helper function to write files

     *

     * @param FileName

     *            The file to write to

     * @param content

     *            Content to write in the file

     */

    public static void printFile(String FileName, String content) {

        PrintWriter writer;

        try {

            writer = new PrintWriter(FileName, "UTF-8");

            writer.print(content);

            writ
展开阅读全文