Results 1 to 2 of 2
- 04-07-2010, 04:38 PM #1
Member
- Join Date
- Apr 2010
- Posts
- 2
- Rep Power
- 0
JavaMail POP3Message.getSize() problem
I am using the getSize() method for the POP3Message object to get the size of the message. I noticed the size returned from the method getSize() is not the same is what is returned from the LIST command. And in some cases is off by like 600 bytes. I understand that the docs say that the size may not be exact but I would expect that the JavaMail API would at least tell me whatever the POP3 protocol returns from the command. Has anyone else noticed this problem and know of a work around to getting the size that the LIST command actually returns?
I'm using JavaMail 1.4 btw.
- 04-07-2010, 09:31 PM #2
Member
- Join Date
- Apr 2010
- Posts
- 2
- Rep Power
- 0
Ok, I think I solved my own problem. Thought I would share.
Basically I used the POP3Folder.listCommand() which executes the LIST command with no arguments. (I couldn't find how to pass an argument to the LIST command) This will return a list of all the messages and their sizes in the form of an InputStream. I then read the stream into a String and parsed the string with StringTokenizer and found the size associated with the message number I was looking for. Getting the size this way will not only give the "correct" POP3 size but also not call the TOP command and pull down the entire header...which apparently the POP3Message.getSize() method calls before it calls the LIST command even though it is unnecessary. Ofcourse if there are a lot of messages on the server this may not be saving you much data transfer since JavaMail won't let you pass the LIST command an argument and have to pull down the entire list.
Similar Threads
-
JavaMail API
By eponcedeleon in forum Advanced JavaReplies: 1Last Post: 02-28-2010, 12:39 AM -
JavaMail Jar
By rummy in forum Advanced JavaReplies: 1Last Post: 01-21-2010, 03:51 PM -
getSize() issue - Displaying object in 3 locations in Applet
By furry in forum New To JavaReplies: 4Last Post: 03-21-2009, 11:43 PM -
[SOLVED] JavaMail Authentication Problem
By frost750 in forum New To JavaReplies: 1Last Post: 02-06-2009, 04:02 PM -
Javamail
By v_mallikarjun in forum Advanced JavaReplies: 14Last Post: 04-18-2008, 07:32 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks