123456789101112131415161718192021222324252627 |
- package com.toolkit.file.encode.frame.filetoUtf8;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.OutputStreamWriter;
- public class CreateUTF8File{
- public void create(String outPath, String content) {
- try {
- File out = new File(outPath);
- FileOutputStream outFile = new FileOutputStream(out);
- OutputStreamWriter writer = new OutputStreamWriter(outFile, "UTF–8");
- writer.write(content);
- writer.close();
- outFile.close();
- out = null;
- } catch (FileNotFoundException e) {
- System.out.println(e.getMessage());
- } catch (IOException ioEx) {
- System.out.println(ioEx.getMessage());
- }
- }
- }
|