Reputation: 196
I am still on trying to create my android newsreader for my university's newsgroup server and once again I am stuck. I am currently using the Apache NNTPClient Library for all of my network calls. I manage to receive the messages and everything is fine except for proper proper article decoding.
I have little to no clue how I should go about dealing with all the different Content-type
attributes that a newsgroup article can be written in. Is there any Java library that already does this in order to get properly encoded Java strings or the content of multipart messages? Is there any way of using the javax.mail Api to parse all the possible response formats?
I am really glad for every piece of information you guys can share with me as it is a more or less dead technology and retrieving documentation and help is cumbersome.
Thank you!
Upvotes: -1
Views: 320
Reputation: 29971
Newsgroup articles are MIME messages, which JavaMail can parse using the MimeMessage constructor. That will allow you to access all the header fields as well as the content of the message. For text content, you can get the content as a String, which you can then display or manipulate however you want. For non-text content, you can get the raw data as an InputStream, or save the content to a file.
How to display the many different MIME types of content is a whole separate problem, which depends heavily on what type of application you're writing.
Upvotes: 1