com.rometools.rome.feed.atom.Feed.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(181)

本文整理了Java中com.rometools.rome.feed.atom.Feed.<init>()方法的一些代码示例,展示了Feed.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feed.<init>()方法的具体详情如下:
包路径:com.rometools.rome.feed.atom.Feed
类名称:Feed
方法名:<init>

Feed.<init>介绍

[英]Default constructor, for bean cloning purposes only.
[中]默认构造函数,仅用于bean克隆目的。

代码示例

代码示例来源:origin: spring-projects/spring-framework

/**
 * Create a new Feed instance to hold the entries.
 * <p>By default returns an Atom 1.0 feed, but the subclass can specify any Feed.
 * @see #setFeedType(String)
 */
@Override
protected Feed newFeed() {
  return new Feed(this.feedType);
}

代码示例来源:origin: org.springframework/spring-webmvc

/**
 * Create a new Feed instance to hold the entries.
 * <p>By default returns an Atom 1.0 feed, but the subclass can specify any Feed.
 * @see #setFeedType(String)
 */
@Override
protected Feed newFeed() {
  return new Feed(this.feedType);
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void writeOtherCharset() throws IOException, SAXException {
  Feed feed = new Feed("atom_1.0");
  feed.setTitle("title");
  String encoding = "ISO-8859-1";
  feed.setEncoding(encoding);
  MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
  converter.write(feed, null, outputMessage);
  assertEquals("Invalid content-type", new MediaType("application", "atom+xml", Charset.forName(encoding)),
      outputMessage.getHeaders().getContentType());
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void write() throws IOException, SAXException {
  Feed feed = new Feed("atom_1.0");
  feed.setTitle("title");
  Entry entry1 = new Entry();
  entry1.setId("id1");
  entry1.setTitle("title1");
  Entry entry2 = new Entry();
  entry2.setId("id2");
  entry2.setTitle("title2");
  List<Entry> entries = new ArrayList<>(2);
  entries.add(entry1);
  entries.add(entry2);
  feed.setEntries(entries);
  MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
  converter.write(feed, null, outputMessage);
  assertEquals("Invalid content-type", new MediaType("application", "atom+xml", StandardCharsets.UTF_8),
      outputMessage.getHeaders().getContentType());
  String expected = "<feed xmlns=\"http://www.w3.org/2005/Atom\">" + "<title>title</title>" +
      "<entry><id>id1</id><title>title1</title></entry>" +
      "<entry><id>id2</id><title>title2</title></entry></feed>";
  NodeMatcher nm = new DefaultNodeMatcher(ElementSelectors.byName);
  assertThat(outputMessage.getBodyAsString(StandardCharsets.UTF_8),
      isSimilarTo(expected).ignoreWhitespace().withNodeMatcher(nm));
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Create a new Feed instance to hold the entries.
 * <p>By default returns an Atom 1.0 feed, but the subclass can specify any Feed.
 * @see #setFeedType(String)
 */
@Override
protected Feed newFeed() {
  return new Feed(this.feedType);
}

代码示例来源:origin: stackoverflow.com

var my_feed = new Feed("some value");
myFeed.loadFeed("some value", "some other value");

代码示例来源:origin: stackoverflow.com

private Feed feed = new Feed();

feed.entries.add(feed.toString());

代码示例来源:origin: stackoverflow.com

feed = new Feed()
Feed.entries.add(feed.toString());

代码示例来源:origin: stackoverflow.com

public List<Feed> readandparseJSON (String in) {

  List<Feed> feeds = new ArrayList<Feed>();

  try {
    JSONObject reader = new JSONObject(in);
    JSONArray feed = reader.getJSONArray("feed");
    JSONObject reader1= feed.getJSONObject(feed.length());

    for (int i=0; i<=reader1.length();i++)
    {
      Feed feed = new Feed();
      feed.setName(reader1.getString("name"));
      feed.setUrl(reader1.getString("url"));
      feeds.add(feed);
    }

  } catch (JSONException e) {
    e.printStackTrace();
  }

  return feeds;

}

代码示例来源:origin: stackoverflow.com

screen = new Feed();
screen.setArguments(params);

代码示例来源:origin: com.rometools/rome

/**
 * Utility method to serialize an entry to writer.
 */
public static void serializeEntry(final Entry entry, final Writer writer) throws IllegalArgumentException, FeedException, IOException {
  // Build a feed containing only the entry
  final List<Entry> entries = new ArrayList<Entry>();
  entries.add(entry);
  final Feed feed1 = new Feed();
  feed1.setFeedType("atom_1.0");
  feed1.setEntries(entries);
  // Get Rome to output feed as a JDOM document
  final WireFeedOutput wireFeedOutput = new WireFeedOutput();
  final Document feedDoc = wireFeedOutput.outputJDom(feed1);
  // Grab entry element from feed and get JDOM to serialize it
  final Element entryElement = feedDoc.getRootElement().getChildren().get(0);
  final XMLOutputter outputter = new XMLOutputter();
  outputter.output(entryElement, writer);
}

代码示例来源:origin: rometools/rome

/**
 * Utility method to serialize an entry to writer.
 */
public static void serializeEntry(final Entry entry, final Writer writer) throws IllegalArgumentException, FeedException, IOException {
  // Build a feed containing only the entry
  final List<Entry> entries = new ArrayList<Entry>();
  entries.add(entry);
  final Feed feed1 = new Feed();
  feed1.setFeedType("atom_1.0");
  feed1.setEntries(entries);
  // Get Rome to output feed as a JDOM document
  final WireFeedOutput wireFeedOutput = new WireFeedOutput();
  final Document feedDoc = wireFeedOutput.outputJDom(feed1);
  // Grab entry element from feed and get JDOM to serialize it
  final Element entryElement = feedDoc.getRootElement().getChildren().get(0);
  final XMLOutputter outputter = new XMLOutputter();
  outputter.output(entryElement, writer);
}

代码示例来源:origin: rometools/rome

private InputStream createDefaultFeedDocument(final String uri) throws AtomException {
  final Feed f = new Feed();
  f.setTitle("Feed");
  f.setId(uri);
  f.setFeedType(FEED_TYPE);
  final Link selfLink = new Link();
  selfLink.setRel("self");
  selfLink.setHref(uri);
  f.getOtherLinks().add(selfLink);
  try {
    final WireFeedOutput wireFeedOutput = new WireFeedOutput();
    final Document feedDoc = wireFeedOutput.outputJDom(f);
    final XMLOutputter outputter = new XMLOutputter();
    // outputter.setFormat(Format.getCompactFormat());
    final OutputStream fos = FileStore.getFileStore().getFileOutputStream(getFeedPath());
    outputter.output(feedDoc, new OutputStreamWriter(fos, "UTF-8"));
  } catch (final FeedException ex) {
    throw new AtomException(ex);
  } catch (final IOException ex) {
    throw new AtomException(ex);
  } catch (final Exception e) {
    e.printStackTrace();
  }
  return FileStore.getFileStore().getFileInputStream(getFeedPath());
}

代码示例来源:origin: rometools/rome

/**
 * 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);
}

代码示例来源:origin: com.rometools/rome

/**
 * 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);
}

代码示例来源:origin: rometools/rome

@Override
public WireFeed createRealFeed(final SyndFeed syndFeed) {
  final Feed aFeed = new Feed(getType());
  aFeed.setModules(ModuleUtils.cloneModules(syndFeed.getModules()));

代码示例来源:origin: rometools/rome

final String styleSheet = getStyleSheet(document);
final Feed feed = new Feed(type);
feed.setStyleSheet(styleSheet);

代码示例来源:origin: com.rometools/rome

final String styleSheet = getStyleSheet(document);
final Feed feed = new Feed(type);
feed.setStyleSheet(styleSheet);

代码示例来源:origin: rometools/rome

private Feed parseFeedMetadata(final String baseURI, final Element eFeed, final Locale locale) {
  final com.rometools.rome.feed.atom.Feed feed = new com.rometools.rome.feed.atom.Feed(getType());

代码示例来源:origin: com.rometools/rome

private Feed parseFeedMetadata(final String baseURI, final Element eFeed, final Locale locale) {
  final com.rometools.rome.feed.atom.Feed feed = new com.rometools.rome.feed.atom.Feed(getType());

相关文章