开发者

Problem while reading .eml file as a properties file

开发者 https://www.devze.com 2023-03-28 17:54 出处:网络
I have a .eml file , in th开发者_开发知识库at i have some key value pairs like below Received: by exchange.mail.com

I have a .eml file , in th开发者_开发知识库at i have some key value pairs like below

Received: by exchange.mail.com 
id <01CC537B.684C4154@exchange.mail.com>; Fri, 5 Aug 2011 19:54:38 +0530
Content-class: urn:content-classes:dsn
Subject: Undeliverable: Prudential mail
Date: Fri, 5 Aug 2011 19:54:38 +0530
MIME-Version: 1.0
Content-Type: multipart/report;
report-type=delivery-status;
boundary="----_=_NextPart_001_01CC537B.684C4154"
This is a multi-part message in MIME format.

when im trying to get keys , its considering 'id', 'This' also as keys, but my requirement is to get the key-values only by symbols ':' and '='

how can i set the key-value's my own separator...

(Extra information I am using java the code is as follows....)

strMailPath = "E:\\BMT_work\\Sample.eml";
File f = new File(strMailPath);
Properties pro = new Properties();
FileInputStream in = new FileInputStream(f);
pro.load(in);
System.out.println("All key are given: " + pro.keySet());
System.out.println("All values are given: " + pro.values());
ArrayList al = new ArrayList(pro.keySet());
ArrayList al2 = new ArrayList(pro.values());
for (int i = 0; i < al.size(); i++) {
  System.out.println((i+1)+" "+al.get(i)+" = "+al2.get(i));
}

thanks in adv.


Make your own version of java.util.Properties and re-implement private void load0 (LineReader lr). Note that ':' and '=' are hardcoded and you can changed them in that method.

0

精彩评论

暂无评论...
验证码 换一张
取 消