javamail - The message content in a line is becomes 2 lines when reading from InputStream -


i using android javamail. parse inputstream of content myself. use

inputstreamreader reader = new inputstreamreader(messages[i].getinputstream()); int value; stringbuilder out = new stringbuilder(); while((value = reader.read()) != -1) {     out.append((char) value); } reader.close(); log.i(tag, out.tostring()); 

the original string content :

<body lang=3d"zh-tw" link=3d"#0563c1" vlink=3d"#954f72" style=3d"text-justify-trim:punctuation"> 

but when in printout result

<body lang=3d"zh-tw" link=3d"#0563c1" vlink=3d"#954f72" style=3d"text-justi= fy-trim:punctuation"> 

there "=" in line , breaks 2 line.

"=" seems indicate line not ended yet. how did happen? if line ends =, how can differentiate?

bill, can work work around problems broken imap servers

according https://tools.ietf.org/html/rfc3501#section-6.4.5

arguments:  sequence set                message data item names or macro 

so seems can fetch uid specified.

when using javamail, though have api fetch message uid.

    javax.mail.message[] messages = folder.getmessagesbyuid(localfolderobject.getuidnext(),                                  serverfolderobject.getuidnext());      (int = 0; < messages.length; ++i) {             // message object folder              mimemessage msg = (mimemessage) messages[i];            // copy message writing byte array.               bytearrayoutputstream bos = new bytearrayoutputstream();                         try {                             msg.writeto(bos);                             bos.close();                             log.i(tag, bos.tostring());                         }                          catch (ioexception e) {                             e.printstacktrace();                         }     } 

the fetch issue as

a38 fetch 1 (body[]) 

1 message sequence number, not uid.

the server wants fetch

a5 uid fetch 291 (body[]) 

is there api "uid fetch" command getting message https://tools.ietf.org/html/rfc3501#section-6.4.8? won't retreive messages every time. keep previous last nextuid , next time retrieve start previous save next uid. due fetch sequence number, server return first sequnce message instead of 1 want.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -