1
import java.io.FileInputStream;
2
import java.io.IOException;
3
import java.io.InputStreamReader;
4
import javax.swing.text.BadLocationException;
5
import javax.swing.text.Document;
6
import javax.swing.text.rtf.RTFEditorKit;
7
8
public class REFRead {
9
10
public static void main(String[] args) throws IOException,
11
BadLocationException {
12
RTFEditorKit kit = new RTFEditorKit();
13
Document doc = kit.createDefaultDocument();
14
FileInputStream fis = new java.io.FileInputStream("e:\\aaa.rtf");
15
InputStreamReader in = new InputStreamReader(fis, "utf-8");
16
kit.read(in, doc, 0);
17
String result = doc.getText(0, doc.getLength());
18
result = new String(result.getBytes("ISO8859_1"));
19
System.out.println(result);
20
}
21
}

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21
