eml file

[nobr]Hello Friends

i am having a eml file and

in the eml file content is as follows

AA 06/04/06Total 5199

usd286626.150.0031593.87255032.28152621.86

0.00102410.42

Amadeus WaterwaysDEPARTURE REVENUE REPORT -

DetailDate: 08/08/06

ChatsworthShip Code: aa Currency: usd Office:

ama Agency: all Time: 11:15:13

SDR V.6 All Sailings Departing 01/01/06

to 12/31/10Page:18

SailingOfficeAgency IDBook#Group #Cb #Pax Passenger Name

CrcGross FareDiscountsCommissionNet FarePaymentsA/R

CreditBalance Due

-- -- --

--- --

AA 06/11/06 AMA00006575 12 Angus SMITH

USD12819.180.00 0.0012819.1812819.18

0.00 0.00

iBufferedReader in =new BufferedReader(new FileReader(path+"Email"+File.separator+"AMA Report.eml"));

BufferedWriter outing =new BufferedWriter(new FileWriter(path+"Email"+File.separator+"AMA Report1.eml"));

for(int s=0;(m=in.readLine()) !=null;s++)

{

if(m.equals(""))

{

s++;

}

else

{

z = m;

out.println(z+"<br> ");

outing.write(z);

outing.write("\n");

}

}

outing.close();

using the above code i cant able to write that eml in another file

how to write

Please Help me

thanks

in the[/nobr]

[1977 byte] By [Chilakalaa] at [2007-10-3 3:00:56]
# 1
What's the problem?
CeciNEstPasUnProgrammeura at 2007-7-14 20:50:35 > top of Java-index,Java Essentials,New To Java...
# 2
i am able to read the filebut i am not able to write the file
Chilakalaa at 2007-7-14 20:50:35 > top of Java-index,Java Essentials,New To Java...
# 3
How to read and Write a eml fileplease help me
Chilakalaa at 2007-7-14 20:50:35 > top of Java-index,Java Essentials,New To Java...
# 4
how is the program behaving? is out.println(z+" "); being executed correctly?Are you getting any exceptions?
r035198xa at 2007-7-14 20:50:35 > top of Java-index,Java Essentials,New To Java...
# 5
i am not getting any Exceptionsif you execute above code in a jsp page then i all the data is displaying in jsp page.my problem is i am not able to write that file
Chilakalaa at 2007-7-14 20:50:35 > top of Java-index,Java Essentials,New To Java...
# 6
Please show the entire method.
CeciNEstPasUnProgrammeura at 2007-7-14 20:50:35 > top of Java-index,Java Essentials,New To Java...
# 7

i am having a AMA Report.eml file and the Content is

Amadeus WaterwaysDEPARTURE REVENUE REPORT -

DetailDate: 08/08/06

ChatsworthShip Code: aa Currency: usd Office:

ama Agency: all Time: 11:15:08

SDR V.6 All Sailings Departing 01/01/06

to 12/31/10Page:1

SailingOfficeAgency IDBook#Group #Cb #Pax Passenger Name

CrcGross FareDiscountsCommissionNet FarePaymentsA/R

CreditBalance Due

-- -- --

--- --

AA 03/26/06 AMA005501960002372 000254 12 Agnes BUTERBAUG

USD4124.000.00683.283440.723440.72

0.00 0.00

0002373 000254 12 Donna BRICKER L

USD4124.000.00683.283440.723440.72

0.00 0.00

0002374 000254 12 Jean Marie HOOD

USD4124.000.00683.283440.723440.72

0.00 0.00

0002375 000254 12 Jacqueline JOHN

USD4124.000.00683.283440.723440.72

0.00 0.00

0002377 000254 12 Karen HARTMAN L

USD4124.000.00683.283440.723440.72

0.00 0.00

0002378 000254 12 Margaret WESTBR

USD2226.000.00341.641884.361884.36

0.00 0.00

0003574 000254 12 Karen HASENKOPF

USD4124.000.00683.283440.723440.72

0.00 0.00

055999410001826 000041 12 Robert HAVEMANN

USD4164.000.001198.802965.202965.20

0.00 0.00

Now my task is

i want to read AMA Report.eml file and i want to create table in database name (abc)

and i want to create colname as mentioned in the mail

SailingOfficeAgency IDBook#Group #Cb #Pax Passenger Name

CrcGross FareDiscountsCommissionNet FarePaymentsA/R

CreditBalance Due

and i have to store all the data accourding to that mail abc table.

i think so now u can understand my problem

Chilakalaa at 2007-7-14 20:50:35 > top of Java-index,Java Essentials,New To Java...
# 8
I do not see why you need to write to another eml file.Just connect to the db, create the table and insert the values.
r035198xa at 2007-7-14 20:50:35 > top of Java-index,Java Essentials,New To Java...
# 9

yah u r write

but my problem is How to recognize that the following are different fields

-> line a :- SailingOfficeAgency IDBook#Group #Cb #Pax Passenger Name

CrcGross FareDiscountsCommissionNet FarePaymentsA/R

CreditBalance Due

-> 1 AA 03/26/06 AMA 005501960002372 000254 12 Agnes BUTERBAUG

USD4124.000.00683.283440.723440.72

0.00 0.00

>2 0002373 000254 12 Donna BRICKER L

USD4124.000.00683.283440.723440.72

0.00 0.00

with String tokenzer i can do but if you observe line a inthat Pax Passenger Name is one word only

i not getting logic to get the fields

line a is not static.

what to do

u understood my problem know?

Chilakalaa at 2007-7-14 20:50:35 > top of Java-index,Java Essentials,New To Java...
# 10

> line a is not static.

>

> what to do

>

> u understood my problem know?

Yes. You lack basic analysis skills. If you didn't, you would see that the fields you have underlined are simply a header for the following rows, and that attempting to process the entire file in a loop before extracting this information will lead to data being extracted incorrectly. How to solve it? Extract those three fields before using StringTokenizer to parse through the rest of the file.

What I don't understand is why you needed to post at least 3 different times before clearly identifying your problem. Why did you complain about being unable to write the EML file? Your topic should have been more like "Need help parsing file"

Brian

brian@cubik.caa at 2007-7-14 20:50:35 > top of Java-index,Java Essentials,New To Java...