📄 syndfeedimpl.html
字号:
<a name="179" href="#179">179</a> <a name="180" href="#180">180</a> <em>/**<em>*</em></em><a name="181" href="#181">181</a> <em> * Creates a real feed containing the information of the SyndFeedImpl.</em><a name="182" href="#182">182</a> <em> * <p></em><a name="183" href="#183">183</a> <em> * The feed type of the created WireFeed is taken from the SyndFeedImpl feedType property.</em><a name="184" href="#184">184</a> <em> * <p></em><a name="185" href="#185">185</a> <em> * @return the real feed.</em><a name="186" href="#186">186</a> <em> *</em><a name="187" href="#187">187</a> <em> */</em><a name="188" href="#188">188</a> <strong>public</strong> <a href="../../../../../com/sun/syndication/feed/WireFeed.html">WireFeed</a> createWireFeed() {<a name="189" href="#189">189</a> <strong>return</strong> createWireFeed(_feedType);<a name="190" href="#190">190</a> }<a name="191" href="#191">191</a> <a name="192" href="#192">192</a> <em>/**<em>*</em></em><a name="193" href="#193">193</a> <em> * Creates a real feed containing the information of the SyndFeedImpl.</em><a name="194" href="#194">194</a> <em> * <p></em><a name="195" href="#195">195</a> <em> * @param feedType the feed type for the WireFeed to be created.</em><a name="196" href="#196">196</a> <em> * @return the real feed.</em><a name="197" href="#197">197</a> <em> *</em><a name="198" href="#198">198</a> <em> */</em><a name="199" href="#199">199</a> <strong>public</strong> <a href="../../../../../com/sun/syndication/feed/WireFeed.html">WireFeed</a> createWireFeed(String feedType) {<a name="200" href="#200">200</a> <strong>if</strong> (feedType==<strong>null</strong>) {<a name="201" href="#201">201</a> <strong>throw</strong> <strong>new</strong> IllegalArgumentException(<span class="string">"Feed type cannot be null"</span>);<a name="202" href="#202">202</a> }<a name="203" href="#203">203</a> <a href="../../../../../com/sun/syndication/feed/synd/Converter.html">Converter</a> converter = CONVERTERS.getConverter(feedType);<a name="204" href="#204">204</a> <strong>if</strong> (converter==<strong>null</strong>) {<a name="205" href="#205">205</a> <strong>throw</strong> <strong>new</strong> IllegalArgumentException(<span class="string">"Invalid feed type ["</span>+feedType+<span class="string">"]"</span>);<a name="206" href="#206">206</a> }<a name="207" href="#207">207</a> <strong>return</strong> converter.createRealFeed(<strong>this</strong>);<a name="208" href="#208">208</a> }<a name="209" href="#209">209</a> <a name="210" href="#210">210</a> <em>/**<em>*</em></em><a name="211" href="#211">211</a> <em> * Returns the wire feed type the feed had/will-have when coverted from/to a WireFeed.</em><a name="212" href="#212">212</a> <em> * <p></em><a name="213" href="#213">213</a> <em> * @return the feed type, <b>null</b> if none.</em><a name="214" href="#214">214</a> <em> *</em><a name="215" href="#215">215</a> <em> */</em><a name="216" href="#216">216</a> <strong>public</strong> String getFeedType() {<a name="217" href="#217">217</a> <strong>return</strong> _feedType;<a name="218" href="#218">218</a> }<a name="219" href="#219">219</a> <a name="220" href="#220">220</a> <em>/**<em>*</em></em><a name="221" href="#221">221</a> <em> * Sets the wire feed type the feed will-have when coverted to a WireFeed.</em><a name="222" href="#222">222</a> <em> * <p></em><a name="223" href="#223">223</a> <em> * @param feedType the feed type to set, <b>null</b> if none.</em><a name="224" href="#224">224</a> <em> *</em><a name="225" href="#225">225</a> <em> */</em><a name="226" href="#226">226</a> <strong>public</strong> <strong>void</strong> setFeedType(String feedType) {<a name="227" href="#227">227</a> _feedType = feedType;<a name="228" href="#228">228</a> }<a name="229" href="#229">229</a> <a name="230" href="#230">230</a> <em>/**<em>*</em></em><a name="231" href="#231">231</a> <em> * Returns the charset encoding of a the feed. This is not set by Rome parsers.</em><a name="232" href="#232">232</a> <em> * <p></em><a name="233" href="#233">233</a> <em> * @return the charset encoding of the feed.</em><a name="234" href="#234">234</a> <em> *</em><a name="235" href="#235">235</a> <em> */</em><a name="236" href="#236">236</a> <strong>public</strong> String getEncoding() {<a name="237" href="#237">237</a> <strong>return</strong> _encoding;<a name="238" href="#238">238</a> }<a name="239" href="#239">239</a> <a name="240" href="#240">240</a> <em>/**<em>*</em></em><a name="241" href="#241">241</a> <em> * Sets the charset encoding of a the feed. This is not set by Rome parsers.</em><a name="242" href="#242">242</a> <em> * <p></em><a name="243" href="#243">243</a> <em> * @param encoding the charset encoding of the feed.</em><a name="244" href="#244">244</a> <em> *</em><a name="245" href="#245">245</a> <em> */</em><a name="246" href="#246">246</a> <strong>public</strong> <strong>void</strong> setEncoding(String encoding) {<a name="247" href="#247">247</a> _encoding = encoding;<a name="248" href="#248">248</a> }<a name="249" href="#249">249</a> <a name="250" href="#250">250</a> <em>/**<em>*</em></em><a name="251" href="#251">251</a> <em> * Returns the feed URI.</em><a name="252" href="#252">252</a> <em> * <p></em><a name="253" href="#253">253</a> <em> * How the feed URI maps to a concrete feed type (RSS or Atom) depends on</em><a name="254" href="#254">254</a> <em> * the concrete feed type. This is explained in detail in Rome documentation,</em><a name="255" href="#255">255</a> <em> * <a href="<a href="http://wiki.java.net/bin/edit/Javawsxml/Rome04URIMapping" target="alexandria_uri">http://wiki.java.net/bin/edit/Javawsxml/Rome04URIMapping</a>">Feed and entry URI mapping</a>.</em><a name="256" href="#256">256</a> <em> * <p></em><a name="257" href="#257">257</a> <em> * The returned URI is a normalized URI as specified in RFC 2396bis.</em><a name="258" href="#258">258</a> <em> * <p></em><a name="259" href="#259">259</a> <em> * Note: The URI is the unique identifier, in the RSS 2.0/atom case this is</em><a name="260" href="#260">260</a> <em> * the GUID, for RSS 1.0 this is the URI attribute of the item. The Link</em><a name="261" href="#261">261</a> <em> * is the URL that the item is accessible under, the URI is the</em><a name="262" href="#262">262</a> <em> * permanent identifier which the aggregator should use to reference</em><a name="263" href="#263">263</a> <em> * this item. Often the URI will use some standardized identifier scheme</em><a name="264" href="#264">264</a> <em> * such as DOI's so that items can be identified even if they appear in</em><a name="265" href="#265">265</a> <em> * multiple feeds with different "links" (they might be on different</em><a name="266" href="#266">266</a> <em> * hosting platforms but be the same item). Also, though rare, there</em><a name="267" href="#267">267</a> <em> * could be multiple items with the same link but a different URI and</em><a name="268" href="#268">268</a> <em> * associated metadata which need to be treated as distinct entities.</em><a name="269" href="#269">269</a> <em> * In the RSS 1.0 case the URI must be a valid RDF URI reference.</em><a name="270" href="#270">270</a> <em> * <p></em><a name="271" href="#271">271</a> <em> * @return the feed URI, <b>null</b> if none.</em><a name="272" href="#272">272</a> <em> *</em><a name="273" href="#273">273</a> <em> */</em><a name="274" href="#274">274</a> <strong>public</strong> String getUri() {<a name="275" href="#275">275</a> <strong>return</strong> _uri;<a name="276" href="#276">276</a> }<a name="277" href="#277">277</a> <a name="278" href="#278">278</a> <em>/**<em>*</em></em><a name="279" href="#279">279</a> <em> * Sets the feed URI.</em><a name="280" href="#280">280</a> <em> * <p></em><a name="281" href="#281">281</a> <em> * How the feed URI maps to a concrete feed type (RSS or Atom) depends on</em><a name="282" href="#282">282</a> <em> * the concrete feed type. This is explained in detail in Rome documentation,</em><a name="283" href="#283">283</a> <em> * <a href="<a href="http://wiki.java.net/bin/edit/Javawsxml/Rome04URIMapping" target="alexandria_uri">http://wiki.java.net/bin/edit/Javawsxml/Rome04URIMapping</a>">Feed and entry URI mapping</a>.</em><a name="284" href="#284">284</a> <em> * <p></em><a name="285" href="#285">285</a> <em> * Note: The URI is the unique identifier, in the RSS 2.0/atom case this is</em><a name="286" href="#286">286</a> <em> * the GUID, for RSS 1.0 this is the URI attribute of the item. The Link</em><a name="287" href="#287">287</a> <em> * is the URL that the item is accessible under, the URI is the</em><a name="288" href="#288">288</a> <em> * permanent identifier which the aggregator should use to reference</em><a name="289" href="#289">289</a> <em> * this item. Often the URI will use some standardized identifier scheme</em><a name="290" href="#290">290</a> <em> * such as DOI's so that items can be identified even if they appear in</em><a name="291" href="#291">291</a> <em> * multiple feeds with different "links" (they might be on different</em><a name="292" href="#292">292</a> <em> * hosting platforms but be the same item). Also, though rare, there</em><a name="293" href="#293">293</a> <em> * could be multiple items with the same link but a different URI and</em><a name="294" href="#294">294</a> <em> * associated metadata which need to be treated as distinct entities.</em><a name="295" href="#295">295</a> <em> * In the RSS 1.0 case the URI must be a valid RDF URI reference.</em><a name="296" href="#296">296</a> <em> * <p></em><a name="297" href="#297">297</a> <em> * @param uri the feed URI to set, <b>null</b> if none.</em><a name="298" href="#298">298</a> <em> *</em><a name="299" href="#299">299</a> <em> */</em><a name="300" href="#300">300</a> <strong>public</strong> <strong>void</strong> setUri(String uri) {<a name="301" href="#301">301</a> _uri = URINormalizer.normalize(uri);<a name="302" href="#302">302</a> }<a name="303" href="#303">303</a> <a name="304" href="#304">304</a> <em>/**<em>*</em></em><a name="305" href="#305">305</a> <em> * Returns the feed title.</em><a name="306" href="#306">306</a> <em> * <p></em><a name="307" href="#307">307</a> <em> * @return the feed title, <b>null</b> if none.</em><a name="308" href="#308">308</a> <em> *</em><a name="309" href="#309">309</a> <em> */</em><a name="310" href="#310">310</a> <strong>public</strong> String getTitle() {<a name="311" href="#311">311</a> <strong>if</strong> (_title != <strong>null</strong>) <strong>return</strong> _title.getValue();<a name="312" href="#312">312</a> <strong>return</strong> <strong>null</strong>;<a name="313" href="#313">313</a> }<a name="314" href="#314">314</a> <a name="315" href="#315">315</a> <em>/**<em>*</em></em><a name="316" href="#316">316</a> <em> * Sets the feed title.</em><a name="317" href="#317">317</a> <em> * <p></em><a name="318" href="#318">318</a> <em> * @param title the feed title to set, <b>null</b> if none.</em><a name="319" href="#319">319</a> <em> *</em><a name="320" href="#320">320</a> <em> */</em><a name="321" href="#321">321</a> <strong>public</strong> <strong>void</strong> setTitle(String title) {<a name="322" href="#322">322</a> <strong>if</strong> (_title == <strong>null</strong>) _title = <strong>new</strong> SyndContentImpl();<a name="323" href="#323">323</a> _title.setValue(title);<a name="324" href="#324">324</a> }<a name="325" href="#325">325</a> <a name="326" href="#326">326</a> <em>/**<em>*</em></em><a name="327" href="#327">327</a> <em> * Returns the feed title as a text construct.</em><a name="328" href="#328">328</a> <em> * <p></em><a name="329" href="#329">329</a> <em> * @return the feed title, <b>null</b> if none.</em><a name="330" href="#330">330</a> <em> *</em><a name="331" href="#331">331</a> <em> */</em><a name="332" href="#332">332</a> <strong>public</strong> <a href="../../../../../com/sun/syndication/feed/synd/SyndContent.html">SyndContent</a> getTitleEx() {<a name="333" href="#333">333</a> <strong>return</strong> _title;<a name="334" href="#334">334</a> }<a name="335" href="#335">335</a> <a name="336" href="#336">336</a> <em>/**<em>*</em></em><a name="337" href="#337">337</a> <em> * Sets the feed title as a text construct.</em><a name="338" href="#338">338</a> <em> * <p></em><a name="339" href="#339">339</a> <em> * @param title the feed title to set, <b>null</b> if none.</em><a name="340" href="#340">340</a> <em> *</em><a name="341" href="#341">341</a> <em> */</em><a name="342" href="#342">342</a> <strong>public</strong> <strong>void</strong> setTitleEx(<a href="../../../../../com/sun/syndication/feed/synd/SyndContent.html">SyndContent</a> title) {<a name="343" href="#343">343</a> _title = title;<a name="344" href="#344">344</a> }<a name="345" href="#345">345</a> <a name="346" href="#346">346</a> <em>/**<em>*</em></em><a name="347" href="#347">347</a> <em> * Returns the feed link.</em><a name="348" href="#348">348</a> <em> * <p></em><a name="349" href="#349">349</a> <em> * Note: The URI is the unique identifier, in the RSS 2.0/atom case this is</em><a name="350" href="#350">350</a> <em> * the GUID, for RSS 1.0 this is the URI attribute of the item. The Link</em><a name="351" href="#351">351</a> <em> * is the URL that the item is accessible under, the URI is the</em><a name="352" href="#352">352</a> <em> * permanent identifier which the aggregator should use to reference</em><a name="353" href="#353">353</a> <em> * this item. Often the URI will use some standardized identifier scheme</em><a name="354" href="#354">354</a> <em> * such as DOI's so that items can be identified even if they appear in</em><a name="355" href="#355">355</a> <em> * multiple feeds with different "links" (they might be on different</em><a name="356" href="#356">356</a> <em> * hosting platforms but be the same item). Also, though rare, there</em><a name="357" href="#357">357</a> <em> * could be multiple items with the same link but a different URI and</em><a name="358" href="#358">358</a> <em> * associated metadata which need to be treated as distinct entities.</em><a name="359" href="#359">359</a> <em> * In the RSS 1.0 case the URI must be a valid RDF URI reference.</em><a name="360" href="#360">360</a> <em> * <p></em><a name="361" href="#361">361</a> <em> * @return the feed link, <b>null</b> if none.</em><a name="362" href="#362">362</a> <em> *</em><a name="363" href="#363">363</a> <em> */</em><a name="364" href="#364">364</a> <strong>public</strong> String getLink() {<a name="365" href="#365">365</a> <strong>return</strong> _link;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -