Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How can i get the message's body size?

843834Oct 7 2009 — edited Oct 9 2009
Hello All,

i am using java mail api to download the messages. when i use getSize() method on message object, i get the size which is not equal when i check the size of .eml file that i have downloaded.

i have trace the protocol also and i got some lines when FETCH command issued like

FETCH (RFC822.SIZE 1482575 INTERNALDATE .........

.
.
.
.

FETCH (BODY[HEADER] {911}
.
.
.

FETCH (BODY[] {1485190}



Here in the above lines, message.getSize gives the size 1482575 bytes and after downloading message , the size of .eml file is 1485190 bytes.

now i have to validate that whether the message is downloaded completely or not, so when i compare the sizes as

if( .eml file size== message.getSize()) and in the above case they dont match. Obviously 1485190 is not equal to 1482575 .

so How will i get the size when FETCH command issued for body like

FETCH (BODY[] {1485190}, so as to i can validate the message.

I want to get the size 1485190 . so How can i do this?

Edited by: Masta_Dushyant on Oct 7, 2009 12:48 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 6 2009
Added on Oct 7 2009
7 comments
493 views