28 changed files with 196 additions and 111 deletions
Binary file not shown.
Binary file not shown.
@ -0,0 +1,32 @@
|
||||
package com.biutag.lan; |
||||
|
||||
import org.junit.jupiter.api.Test; |
||||
|
||||
import java.io.*; |
||||
|
||||
public class TestResource { |
||||
|
||||
@Test |
||||
public void testClassResource() throws IOException { |
||||
// InputStream is = getClass().getResourceAsStream("/templates/《处理反馈表》.doc");
|
||||
File file = new File("D:\\deploy\\文档.doc"); |
||||
FileInputStream is = new FileInputStream(file); |
||||
|
||||
InputStreamReader reader = new InputStreamReader(is, "UTF-8"); |
||||
|
||||
// 创建UTF-8编码的输出流
|
||||
FileOutputStream os = new FileOutputStream("D:\\deploy\\文档1.doc"); |
||||
|
||||
// 创建UTF-8编码的写入器
|
||||
OutputStreamWriter writer = new OutputStreamWriter(os, "UTF-8"); |
||||
|
||||
int c; |
||||
while ((c = reader.read()) != -1) { |
||||
// 将每个字节从ISO-8859-1转换为UTF-8并写入输出流
|
||||
writer.write((char) c); |
||||
} |
||||
// 关闭流
|
||||
reader.close(); |
||||
writer.close(); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue