-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDocUtil.java
More file actions
59 lines (59 loc) · 1.84 KB
/
Copy pathDocUtil.java
File metadata and controls
59 lines (59 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//package Test;
//
///**
// * @author mood321
// * @date 2021/9/1 22:00
// * @email [email protected]
// */
//import java.io.File;
//import java.io.FileInputStream;
//import java.io.FileOutputStream;
//import java.io.IOException;
//import java.util.stream.Stream;
//
//import org.apache.poi.hwpf.extractor.WordExtractor;
//import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
//import org.apache.poi.xwpf.usermodel.XWPFDocument;
//
//public class DocUtil {
// public static String doc2String(File file) throws IOException {
// String result=new String("");
// if(file.getName().toLowerCase().endsWith("docx")){
// return result = docString(new FileInputStream(file));
// } else {
// result=doc2String(new FileInputStream(file));
//
// }
// return result.replace("794643619","");
//
// }
//
// /**
// * 读取doc文件内容
// *
// * @param fs
// * 想要读取的文件对象
// * @return 返回文件内容
// * @throws IOException
// */
// public static String doc2String(FileInputStream fs) throws IOException {
// StringBuilder result = new StringBuilder();
// WordExtractor re = new WordExtractor(fs);
// result.append(re.getText());
// re.close();
// return result.toString();
// }
// public static String docString(FileInputStream fis) throws IOException {
// XWPFDocument xdoc = new XWPFDocument(fis);
// XWPFWordExtractor extractor = new XWPFWordExtractor(xdoc);
// String doc1 = extractor.getText();
// fis.close();
// return doc1;
// }
//
// public static void main(String[] args) {
// System.out.println(Stream.of("green", "yellow", "blue")
// .max((s1,s2) -> s1.compareTo(s2))
// .filter(s -> s.endsWith("n")).orElse ("yellow"));
// }
//}