• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java WireFeedInput类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.rometools.rome.io.WireFeedInput的典型用法代码示例。如果您正苦于以下问题:Java WireFeedInput类的具体用法?Java WireFeedInput怎么用?Java WireFeedInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WireFeedInput类属于com.rometools.rome.io包,在下文中一共展示了WireFeedInput类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: readInternal

import com.rometools.rome.io.WireFeedInput; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected T readInternal(Class<? extends T> clazz, HttpInputMessage inputMessage)
		throws IOException, HttpMessageNotReadableException {

	WireFeedInput feedInput = new WireFeedInput();
	MediaType contentType = inputMessage.getHeaders().getContentType();
	Charset charset =
			(contentType != null && contentType.getCharSet() != null? contentType.getCharSet() : DEFAULT_CHARSET);
	try {
		Reader reader = new InputStreamReader(inputMessage.getBody(), charset);
		return (T) feedInput.build(reader);
	}
	catch (FeedException ex) {
		throw new HttpMessageNotReadableException("Could not read WireFeed: " + ex.getMessage(), ex);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:18,代码来源:AbstractWireFeedHttpMessageConverter.java


示例2: parseEntry

import com.rometools.rome.io.WireFeedInput; //导入依赖的package包/类
/**
 * Parse entry from reader.
 */
public static Entry parseEntry(final Reader rd, final String baseURI, final Locale locale) throws JDOMException, IOException, IllegalArgumentException,
        FeedException {

    // Parse entry into JDOM tree
    final SAXBuilder builder = new SAXBuilder();
    final Document entryDoc = builder.build(rd);
    final Element fetchedEntryElement = entryDoc.getRootElement();
    fetchedEntryElement.detach();

    // Put entry into a JDOM document with 'feed' root so that Rome can
    // handle it
    final Feed feed = new Feed();
    feed.setFeedType("atom_1.0");
    final WireFeedOutput wireFeedOutput = new WireFeedOutput();
    final Document feedDoc = wireFeedOutput.outputJDom(feed);
    feedDoc.getRootElement().addContent(fetchedEntryElement);

    if (baseURI != null) {
        feedDoc.getRootElement().setAttribute("base", baseURI, Namespace.XML_NAMESPACE);
    }

    final WireFeedInput input = new WireFeedInput(false, locale);
    final Feed parsedFeed = (Feed) input.build(feedDoc);
    return parsedFeed.getEntries().get(0);
}
 
开发者ID:rometools,项目名称:rome,代码行数:29,代码来源:Atom10Parser.java


示例3: getFeedDocument

import com.rometools.rome.io.WireFeedInput; //导入依赖的package包/类
/**
 * Get feed document representing collection.
 *
 * @throws com.rometools.rome.propono.atom.server.AtomException On error retrieving feed file.
 * @return Atom Feed representing collection.
 */
public Feed getFeedDocument() throws AtomException {
    InputStream in = null;
    synchronized (FileStore.getFileStore()) {
        in = FileStore.getFileStore().getFileInputStream(getFeedPath());
        if (in == null) {
            in = createDefaultFeedDocument(contextURI + servletPath + "/" + handle + "/" + collection);
        }
    }
    try {
        final WireFeedInput input = new WireFeedInput();
        final WireFeed wireFeed = input.build(new InputStreamReader(in, "UTF-8"));
        return (Feed) wireFeed;
    } catch (final Exception ex) {
        throw new AtomException(ex);
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:23,代码来源:FileBasedCollection.java


示例4: testXmlBomb

import com.rometools.rome.io.WireFeedInput; //导入依赖的package包/类
public void testXmlBomb() throws Exception {

		// https://en.wikipedia.org/wiki/Billion_laughs
		// https://msdn.microsoft.com/en-us/magazine/ee335713.aspx
		String content = "<?xml version=\"1.0\"?>\n" +
				"<!DOCTYPE lolz [\n" +
				" <!ENTITY lol \"lol\">\n" +
				" <!ELEMENT lolz (#PCDATA)>\n" +
				" <!ENTITY lol1 \"&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;\">\n" +
				" <!ENTITY lol2 \"&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;\">\n" +
				" <!ENTITY lol3 \"&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;\">\n" +
				" <!ENTITY lol4 \"&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;\">\n" +
				" <!ENTITY lol5 \"&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;\">\n" +
				" <!ENTITY lol6 \"&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;\">\n" +
				" <!ENTITY lol7 \"&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;\">\n" +
				" <!ENTITY lol8 \"&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;\">\n" +
				" <!ENTITY lol9 \"&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;\">\n" +
				"]>\n" +
				"<feed>\n" +
				"    <title>&lol9;</title>\n" +
				"    <subtitle>subtitle</subtitle>\n" +
				"    <entry>\n" +
				"        <id>id1</id>\n" +
				"        <title>title1</title>\n" +
				"    </entry>\n" +
				"</feed>";

		InputStream is = new ByteArrayInputStream(content.getBytes("UTF-8"));
		WireFeedInput feedInput = new WireFeedInput();
		Reader reader = new InputStreamReader(is, Charset.forName("UTF-8"));
		try {
			feedInput.build(reader);
			fail("Expected exception");
		}
		catch (ParsingFeedException ex) {
		}
	}
 
开发者ID:rometools,项目名称:rome,代码行数:38,代码来源:TestXmlBomb.java


示例5: testTemp

import com.rometools.rome.io.WireFeedInput; //导入依赖的package包/类
public void testTemp() throws Exception {
    final WireFeedInput input = new WireFeedInput();
    final WireFeed wf = input.build(TestUtil.loadFile("/opml_1.0_links.xml"));
    final WireFeedOutput output = new WireFeedOutput();

    final SyndFeedImpl sf = new SyndFeedImpl(wf);
    sf.setFeedType("rss_2.0");
    sf.setDescription("");
    sf.setLink("http://foo.com");
    sf.setFeedType("opml_1.0");
    output.output(sf.createWireFeed(), new NullWriter());
}
 
开发者ID:rometools,项目名称:rome,代码行数:13,代码来源:TestOpsOPML10links.java


示例6: getNextEntries

import com.rometools.rome.io.WireFeedInput; //导入依赖的package包/类
private void getNextEntries() throws ProponoException {
    if (nextURI == null) {
        return;
    }
    final GetMethod colGet = new GetMethod(collection.getHrefResolved(nextURI));
    collection.addAuthentication(colGet);
    try {
        collection.getHttpClient().executeMethod(colGet);
        final SAXBuilder builder = new SAXBuilder();
        final Document doc = builder.build(colGet.getResponseBodyAsStream());
        final WireFeedInput feedInput = new WireFeedInput();
        col = (Feed) feedInput.build(doc);
    } catch (final Exception e) {
        throw new ProponoException("ERROR: fetching or parsing next entries, HTTP code: " + (colGet != null ? colGet.getStatusCode() : -1), e);
    } finally {
        colGet.releaseConnection();
    }
    members = col.getEntries().iterator();
    col.getEntries().size();

    nextURI = null;
    final List<Link> altLinks = col.getOtherLinks();
    if (altLinks != null) {
        for (final Link link : altLinks) {
            if ("next".equals(link.getRel())) {
                nextURI = link.getHref();
            }
        }
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:31,代码来源:EntryIterator.java


示例7: importOpml

import com.rometools.rome.io.WireFeedInput; //导入依赖的package包/类
public void importOpml(User user, String xml) {
	xml = xml.substring(xml.indexOf('<'));
	WireFeedInput input = new WireFeedInput();
	try {
		Opml feed = (Opml) input.build(new StringReader(xml));
		List<Outline> outlines = feed.getOutlines();
		for (int i = 0; i < outlines.size(); i++) {
			handleOutline(user, outlines.get(i), null, i);
		}
	} catch (Exception e) {
		log.error(e.getMessage(), e);
	}

}
 
开发者ID:Athou,项目名称:commafeed,代码行数:15,代码来源:OPMLImporter.java


示例8: getWireFeed

import com.rometools.rome.io.WireFeedInput; //导入依赖的package包/类
protected WireFeed getWireFeed() throws Exception {
    final WireFeedInput in = new WireFeedInput();
    in.setAllowDoctypes(allowDoctypes);
    return in.build(getFeedReader());
}
 
开发者ID:rometools,项目名称:rome,代码行数:6,代码来源:FeedTest.java


示例9: getWireFeed

import com.rometools.rome.io.WireFeedInput; //导入依赖的package包/类
protected WireFeed getWireFeed() throws Exception {
    final WireFeedInput in = new WireFeedInput();
    return in.build(getFeedReader());
}
 
开发者ID:rometools,项目名称:rome,代码行数:5,代码来源:FeedTest.java



注:本文中的com.rometools.rome.io.WireFeedInput类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IPVersionType类代码示例发布时间:2022-05-22
下一篇:
Java EnumConstantDeclaration类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap