订阅android新闻组,使用相应的内容类型解析/解码NNTP新闻组文章

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.

我仍在努力为我的大学的新闻组服务器创建我的android新闻阅读器,我又一次被卡住了。我目前正在使用Apache NNTPClient库进行所有网络调用。我设法收到消息,一切都很好,除了正确的文章解码。

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?

我几乎不知道如何处理可以编写新闻组文章的所有不同的Content-type属性。是否有任何Java库已经这样做以获得正确编码的Java字符串或内容多部分消息?有没有办法使用javax.mail Api来解​​析所有可能的响应格式?

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!

1 个解决方案

#1

1

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.

新闻组文章是MIME消息,JavaMail可以使用MimeMessage构造函数进行解析。这将允许您访问所有标题字段以及消息的内容。对于文本内容,您可以将内容作为String获取,然后可以根据需要显示或操作。对于非文本内容,您可以将原始数据作为InputStream获取,或将内容保存到文件中。

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.

如何显示许多不同的MIME类型的内容是一个完全独立的问题,这在很大程度上取决于您正在编写的应用程序类型。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值