相关文章推荐
傲视众生的桔子  ·  java - Maven surefire ...·  2 年前    · 
ID:324,803DocTitle:15/09/25-certifytruecopyFileName:bakersam8.TIFFileDirectory:.\IMAGES\bakerFileSize:1,051,268FileDate:10/19/20155:32:32pm$FILE$:d:\alchemydata-2008\ttg_... ID: 324,803
Doc Title: 15/09/25 - certify true copy
File Name: bakersam8.TIF
File Directory: .\IMAGES\baker
File Size: 1,051,268
File Date: 10/19/2015 5:32:32pm
$FILE$: d:\alchemy data - 2008\ttg_2008\IMAGES\baker\bakersam8.TIF
$FOLDER$: Bannerman Nic\Baker, Samantha Jane\Client Data\Money Laundering
File Format: TIFF
Doc Type:
Company:
A/C (az/#):
Doc Section:
Personal:
Sector:
Sub Sector:
Salesperson:
Res Country:
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

public class DatDemo {
public static void main(String[] args) throws Exception {

File file = new File("c:\\test.dat");
BufferedReader br = new BufferedReader(new FileReader(file));//输入流
String str;
while((str=br.readLine())!=null){//按行读取
String[] ss = str.trim().split(":");
if(ss.length==2){//如果包含key和value就输出
System.out.println("key="+ss[0].trim()+"\nvalue="+ss[1].trim());
}else{//只有key 没有value就输出value=null
System.out.println("key="+ss[0].trim()+"\nvalue="+"null");
}
}
br.close();//关闭流
}
}

运行测试

key=ID
value=324,803
key=Doc Title
value=15/09/25 - certify true copy
key=File Name
value=bakersam8.TIF
..........
....
.