Java讀取PDF,Doc的方法

2021-05-21 18:47:48 字數 893 閱讀 2237

* description: email:[email protected]

* company: matrix.org.cn

* description: email:[email protected]

* company: matrix.org.cn

* description: email:[email protected]

* company: matrix.org.cn

* @author chris

* @version 1.0,who use this example pls remain the declare

*/ public class pdfwin

public static void main(string args) throws exception

; process p = runtime.getruntime().exec(cmd);

bufferedinputstream bis = new bufferedinputstream(p.getinputstream());

inputstreamreader reader = new inputstreamreader(bis, "utf-8");

stringwriter out = new stringwriter();

char buf = new char[10000];

int len;

while((len = reader.read(buf))>= 0)

reader.close();

string ts=new string(buf);

system.out.println("the str is"+ts);

} }   

java 讀取xml的方法

1 建立要讀取的xml文件 logfile 2 建乙個方法來讀取xml文件 private void readxmltest string infile throws exception catch parserconfigurationexception pce document doc null...

java 讀取檔案的路徑方法

絕對路徑 file file new file c test.txt 從磁碟根目錄開始指定路徑。不建議使用。相對路徑 file file new file test.class.getresource file.txt getfile 獲取test.class同目錄下的檔案 file file1 n...

Java讀取檔案內容方法比較

最近在做乙個語料的清洗程式,需要讀取大量的txt檔案的內容,然後對內容進行一系列的清洗,這時有兩種處理方案,一是用readline 一行一行讀取然後拼接起來,二是一次性讀取,我傾向於一次性將文字的原始內容直接讀取到記憶體中再做處理,因為涉及的檔案量很大,幾 十 幾百g的幾十萬個檔案,這樣提公升一點速...