rtf2text问题?先谢了!
package rtf2text;
import java.io.FileInputStream;
import java.io.*;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.rtf.RTFEditorKit;
import javax.swing.text.*;
public class Rtf2Text {
public Rtf2Text() {
try {
FileInputStream fis = new FileInputStream( "D:/test.rtf ");
DataInputStream dis = new DataInputStream(fis);
DefaultStyledDocument styledDoc = new DefaultStyledDocument();
RTFEditorKit rtfkit = new RTFEditorKit();
try {
rtfkit.read(dis, styledDoc, 0);
Document doc = styledDoc.getDefaultRootElement().getDocument();
System.out.println(doc.getText(0,doc.getLength()));
} catch (BadLocationException ex1) {
ex1.printStackTrace();
} catch (
IOException ex1) {
ex1.printStackTrace();
}
} catch (
FileNotFoundException ex) {
ex.printStackTrace();
}
}
public static void main(String args[]){
new Rtf2Text();
}
}
为什么打出来中文都是??????
求高手帮忙啊
------解决方案--------------------up