IOUtils:读取文件转字符串,中文字符无法转换

public class ConvertFile2String { public static void mainString[] args throws FileNotFoundException, IOException { File file=new File"E:\Code\Jretec\PCBwebsiteProject\PCBProject\新建文本文档.txt"; InputStream in=new FileInputStreamfile;
// String str=IOUtils.toStringin,"utf-8"; StringWriter writer = new StringWriter; IOUtils.copyin, writer, "utf-8"; String str = writer.toString; System.out.printlnstr; }
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注