av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

AndroidXML讀寫(三)

消息基本上是相當(dāng)直觀的。通過(guò)允許日期和鏈接作為簡(jiǎn)單的對(duì)象被訪問,同時(shí)將它們表示為較強(qiáng)類型的對(duì)象(de >java.util.Datede > 和 de >java.net.URLde >),它隱藏了一些內(nèi)部狀態(tài)。它是一個(gè)典型的 Value Object,因此它基于其內(nèi)部狀態(tài)實(shí)現(xiàn)了 de >equals()de > 和 de >hashCode()de >。它還實(shí)現(xiàn)了 de >Comparablede > 接口,因此您可以使用它進(jìn)行排序(按日期)。在實(shí)踐中,提要中的數(shù)據(jù)始終是有序的,因?yàn)闆]有必要再進(jìn)行排序。

我們提供的服務(wù)有:成都網(wǎng)站制作、成都網(wǎng)站設(shè)計(jì)、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、磴口ssl等。為超過(guò)千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的磴口網(wǎng)站制作公司

每個(gè)解析器實(shí)現(xiàn)都需要提供一個(gè) URL 給 Androidster 提要,并使用它打開一個(gè)到 Androidster 站點(diǎn)的 HTTP 連接。這一常見行為自然是在 Java 代碼中建模,我們使用了一個(gè)抽象基類,所示。

基本提要解析器類

java代碼:

 
 
  1. public abstract class BaseFeedParser implements FeedParser { 
  2. // names of the XML tags 
  3. static final String PUB_DATE = "pubDate"; 
  4. static final String DESCRIPTION = "description"; 
  5. static final String LINK = "link"; 
  6. static final String TITLE = "title"; 
  7. static final String ITEM = "item"; 
  8. final URL feedUrl; 
  9. protected BaseFeedParser(String feedUrl){ 
  10. try { 
  11. this.feedUrl = new URL(feedUrl); 
  12. } catch (MalformedURLException e) { 
  13. throw new RuntimeException(e); 
  14. protected InputStream getInputStream() { 
  15. try { 
  16. return feedUrl.openConnection().getInputStream(); 
  17. } catch (IOException e) { 
  18. throw new RuntimeException(e); 

基類存儲(chǔ) de >feedUrlde > 并使用它打開了一個(gè) de >java.io.InputStreamde >。如果出現(xiàn)任何差錯(cuò),它會(huì)拋出一個(gè) de >RuntimeExceptionde >,造成應(yīng)用程序出現(xiàn)故障?;愡€為標(biāo)記的名稱定義了一些簡(jiǎn)單的常量。顯示了提要中的一些示例內(nèi)容,以便于您理解這些標(biāo)記的重要性。

示例 XML 提要

java代碼:

 
 
  1. < ?xml version="1.0" encoding="UTF-8"? > 
  2. < !-- generator="FeedCreator 1.7.2" -- > 
  3. < rss version="2.0" > 
  4. < channel > 
  5. < title >android_news< /title > 
  6. < description >android_news< /description > 
  7. < link >< /link > 
  8. < lastBuildDate >Sun, 19 Apr 2009 19:43:45 +0100< /lastBuildDate > 
  9. < generator >FeedCreator 1.7.2< /generator > 
  10. < item > 
  11. < title >Samsung S8000 to Run Android, Play DivX, Take Over the World< /title > 
  12. < link >< /link > 
  13. < description >More details have emerged on the first Samsung handset 
  14. to run Android. A yet-to-be announced phone called the S8000 is being 
  15. reported ...< /description > 
  16. < pubDate >Thu, 16 Apr 2009 07:18:51 +0100< /pubDate > 
  17. < /item > 
  18. < item > 
  19. < title >Android Cupcake Update on the Horizon< /title > 
  20. < link >< /link > 
  21. < description >After months of discovery and hearsay, the Android 
  22. build that we have all been waiting for is about to finally make it 
  23. out ...< /description > 
  24. < pubDate >Tue, 14 Apr 2009 04:13:21 +0100< /pubDate > 
  25. < /item > 
  26. < /channel > 
  27. < /rss >

標(biāo)題名稱:AndroidXML讀寫(三)
URL網(wǎng)址:http://uogjgqi.cn/article/djiispi.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們?cè)谖⑿派?4小時(shí)期待你的聲音

解答本文疑問/技術(shù)咨詢/運(yùn)營(yíng)咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流