-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRTFTester.java
More file actions
37 lines (34 loc) · 1.34 KB
/
Copy pathRTFTester.java
File metadata and controls
37 lines (34 loc) · 1.34 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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.io.IOUtils;
/**
*
* @author NMoldabe
*/
public class RTFTester {
public static void doStuff(){
try {
String content = IOUtils.toString(new FileInputStream("D:\\TemplateBuilder.rtf"));
content = content.replaceAll("TAB_NUM", "9003");
content = content.replaceAll("FULL_NAME", "Молдабеков Нурлан Амиржанович");
content = content.replaceAll("LOGIN", "NMoldabe");
content = content.replaceAll("ACCEPT_DATE", "2015-09-21");
IOUtils.write(content, new FileOutputStream("D:\\result.rtf"));
} catch (FileNotFoundException ex) {
Logger.getLogger(RTFTester.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(RTFTester.class.getName()).log(Level.SEVERE, null, ex);
}
}
}