com.sun.syndication.io.WireFeedInput.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(14.4k)|赞(0)|评价(0)|浏览(141)

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

WireFeedInput.<init>介绍

[英]Creates a WireFeedInput instance with input validation turned off.
[中]在输入验证关闭的情况下创建WireFeedInput实例。

代码示例

代码示例来源:origin: com.sun.syndication/com.springsource.com.sun.syndication

  1. /**
  2. * Creates a SyndFeedInput instance.
  3. * <p>
  4. * @param validate indicates if the input should be validated. NOT IMPLEMENTED YET (validation does not happen)
  5. *
  6. */
  7. public SyndFeedInput(boolean validate) {
  8. _feedInput = new WireFeedInput(validate);
  9. }

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

  1. /**
  2. * Creates a SyndFeedInput instance.
  3. * <p>
  4. * @param validate indicates if the input should be validated. NOT IMPLEMENTED YET (validation does not happen)
  5. *
  6. */
  7. public SyndFeedInput(boolean validate) {
  8. _feedInput = new WireFeedInput(validate);
  9. }

代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss

  1. /**
  2. * Creates a SyndFeedInput instance.
  3. * <p>
  4. * @param validate indicates if the input should be validated. NOT IMPLEMENTED YET (validation does not happen)
  5. *
  6. */
  7. public SyndFeedInput(boolean validate) {
  8. _feedInput = new WireFeedInput(validate);
  9. }

代码示例来源:origin: apache/marmotta

  1. /**
  2. * Creates a SyndFeedInput instance.
  3. * <p>
  4. * @param validate indicates if the input should be validated. NOT IMPLEMENTED YET (validation does not happen)
  5. *
  6. */
  7. public SyndFeedInput(boolean validate) {
  8. _feedInput = new WireFeedInput(validate);
  9. }

代码示例来源:origin: com.sun.jersey/jersey-bundle

  1. public Feed readFrom(
  2. Class<Feed> type,
  3. Type genericType,
  4. Annotation annotations[],
  5. MediaType mediaType,
  6. MultivaluedMap<String, String> httpHeaders,
  7. InputStream entityStream) throws IOException {
  8. try {
  9. WireFeedInput input = new WireFeedInput();
  10. WireFeed wireFeed = input.build(new InputStreamReader(entityStream));
  11. if (!(wireFeed instanceof Feed)) {
  12. throw new IOException(ImplMessages.ERROR_NOT_ATOM_FEED(type));
  13. }
  14. return (Feed)wireFeed;
  15. } catch (FeedException cause) {
  16. IOException effect = new IOException(ImplMessages.ERROR_MARSHALLING_ATOM(type));
  17. effect.initCause(cause);
  18. throw effect;
  19. }
  20. }

代码示例来源:origin: jersey/jersey-1.x

  1. public Feed readFrom(
  2. Class<Feed> type,
  3. Type genericType,
  4. Annotation annotations[],
  5. MediaType mediaType,
  6. MultivaluedMap<String, String> httpHeaders,
  7. InputStream entityStream) throws IOException {
  8. try {
  9. WireFeedInput input = new WireFeedInput();
  10. WireFeed wireFeed = input.build(new InputStreamReader(entityStream));
  11. if (!(wireFeed instanceof Feed)) {
  12. throw new IOException(ImplMessages.ERROR_NOT_ATOM_FEED(type));
  13. }
  14. return (Feed)wireFeed;
  15. } catch (FeedException cause) {
  16. IOException effect = new IOException(ImplMessages.ERROR_MARSHALLING_ATOM(type));
  17. effect.initCause(cause);
  18. throw effect;
  19. }
  20. }

代码示例来源:origin: com.sun.jersey/jersey-atom

  1. public Feed readFrom(
  2. Class<Feed> type,
  3. Type genericType,
  4. Annotation annotations[],
  5. MediaType mediaType,
  6. MultivaluedMap<String, String> httpHeaders,
  7. InputStream entityStream) throws IOException {
  8. try {
  9. WireFeedInput input = new WireFeedInput();
  10. WireFeed wireFeed = input.build(new InputStreamReader(entityStream));
  11. if (!(wireFeed instanceof Feed)) {
  12. throw new IOException(ImplMessages.ERROR_NOT_ATOM_FEED(type));
  13. }
  14. return (Feed)wireFeed;
  15. } catch (FeedException cause) {
  16. IOException effect = new IOException(ImplMessages.ERROR_MARSHALLING_ATOM(type));
  17. effect.initCause(cause);
  18. throw effect;
  19. }
  20. }

代码示例来源:origin: com.sun.jersey/jersey-bundle

  1. /**
  2. * Parse entry from InputStream.
  3. */
  4. private static Entry parseEntry(InputStream in)
  5. throws JDOMException, IOException, IllegalArgumentException, FeedException {
  6. // Parse entry into JDOM tree
  7. SAXBuilder builder = new SAXBuilder();
  8. Document entryDoc = builder.build(in);
  9. Element fetchedEntryElement = entryDoc.getRootElement();
  10. fetchedEntryElement.detach();
  11. // Put entry into a JDOM document with 'feed' root so that Rome can handle it
  12. Feed feed = new Feed();
  13. feed.setFeedType(FEED_TYPE);
  14. WireFeedOutput wireFeedOutput = new WireFeedOutput();
  15. Document feedDoc = wireFeedOutput.outputJDom(feed);
  16. feedDoc.getRootElement().addContent(fetchedEntryElement);
  17. WireFeedInput input = new WireFeedInput();
  18. Feed parsedFeed = (Feed)input.build(feedDoc);
  19. return (Entry)parsedFeed.getEntries().get(0);
  20. }

代码示例来源:origin: com.sun.jersey/jersey-atom

  1. /**
  2. * Parse entry from InputStream.
  3. */
  4. private static Entry parseEntry(InputStream in)
  5. throws JDOMException, IOException, IllegalArgumentException, FeedException {
  6. // Parse entry into JDOM tree
  7. SAXBuilder builder = new SAXBuilder();
  8. Document entryDoc = builder.build(in);
  9. Element fetchedEntryElement = entryDoc.getRootElement();
  10. fetchedEntryElement.detach();
  11. // Put entry into a JDOM document with 'feed' root so that Rome can handle it
  12. Feed feed = new Feed();
  13. feed.setFeedType(FEED_TYPE);
  14. WireFeedOutput wireFeedOutput = new WireFeedOutput();
  15. Document feedDoc = wireFeedOutput.outputJDom(feed);
  16. feedDoc.getRootElement().addContent(fetchedEntryElement);
  17. WireFeedInput input = new WireFeedInput();
  18. Feed parsedFeed = (Feed)input.build(feedDoc);
  19. return (Entry)parsedFeed.getEntries().get(0);
  20. }

代码示例来源:origin: jersey/jersey-1.x

  1. /**
  2. * Parse entry from InputStream.
  3. */
  4. private static Entry parseEntry(InputStream in)
  5. throws JDOMException, IOException, IllegalArgumentException, FeedException {
  6. // Parse entry into JDOM tree
  7. SAXBuilder builder = new SAXBuilder();
  8. Document entryDoc = builder.build(in);
  9. Element fetchedEntryElement = entryDoc.getRootElement();
  10. fetchedEntryElement.detach();
  11. // Put entry into a JDOM document with 'feed' root so that Rome can handle it
  12. Feed feed = new Feed();
  13. feed.setFeedType(FEED_TYPE);
  14. WireFeedOutput wireFeedOutput = new WireFeedOutput();
  15. Document feedDoc = wireFeedOutput.outputJDom(feed);
  16. feedDoc.getRootElement().addContent(fetchedEntryElement);
  17. WireFeedInput input = new WireFeedInput();
  18. Feed parsedFeed = (Feed)input.build(feedDoc);
  19. return (Entry)parsedFeed.getEntries().get(0);
  20. }

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

  1. /**
  2. * Parse entry from reader.
  3. */
  4. public static Entry parseEntry(Reader rd, String baseURI)
  5. throws JDOMException, IOException, IllegalArgumentException, FeedException {
  6. // Parse entry into JDOM tree
  7. SAXBuilder builder = new SAXBuilder();
  8. Document entryDoc = builder.build(rd);
  9. Element fetchedEntryElement = entryDoc.getRootElement();
  10. fetchedEntryElement.detach();
  11. // Put entry into a JDOM document with 'feed' root so that Rome can handle it
  12. Feed feed = new Feed();
  13. feed.setFeedType("atom_1.0");
  14. WireFeedOutput wireFeedOutput = new WireFeedOutput();
  15. Document feedDoc = wireFeedOutput.outputJDom(feed);
  16. feedDoc.getRootElement().addContent(fetchedEntryElement);
  17. if (baseURI != null) {
  18. feedDoc.getRootElement().setAttribute("base", baseURI, Namespace.XML_NAMESPACE);
  19. }
  20. WireFeedInput input = new WireFeedInput();
  21. Feed parsedFeed = (Feed)input.build(feedDoc);
  22. return (Entry)parsedFeed.getEntries().get(0);
  23. }
  24. }

代码示例来源:origin: com.sun.syndication/com.springsource.com.sun.syndication

  1. /**
  2. * Parse entry from reader.
  3. */
  4. public static Entry parseEntry(Reader rd, String baseURI)
  5. throws JDOMException, IOException, IllegalArgumentException, FeedException {
  6. // Parse entry into JDOM tree
  7. SAXBuilder builder = new SAXBuilder();
  8. Document entryDoc = builder.build(rd);
  9. Element fetchedEntryElement = entryDoc.getRootElement();
  10. fetchedEntryElement.detach();
  11. // Put entry into a JDOM document with 'feed' root so that Rome can handle it
  12. Feed feed = new Feed();
  13. feed.setFeedType("atom_1.0");
  14. WireFeedOutput wireFeedOutput = new WireFeedOutput();
  15. Document feedDoc = wireFeedOutput.outputJDom(feed);
  16. feedDoc.getRootElement().addContent(fetchedEntryElement);
  17. if (baseURI != null) {
  18. feedDoc.getRootElement().setAttribute("base", baseURI, Namespace.XML_NAMESPACE);
  19. }
  20. WireFeedInput input = new WireFeedInput();
  21. Feed parsedFeed = (Feed)input.build(feedDoc);
  22. return (Entry)parsedFeed.getEntries().get(0);
  23. }
  24. }

代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss

  1. /**
  2. * Parses the data from the supplied InputStream, using the supplied baseURI
  3. * to resolve any relative URI references.
  4. *
  5. * @param in The InputStream from which to read the data.
  6. * @param baseURI The URI associated with the data in the InputStream.
  7. * @throws java.io.IOException If an I/O error occurred while data was read from the InputStream.
  8. * @throws org.openrdf.rio.RDFParseException
  9. * If the parser has found an unrecoverable parse error.
  10. * @throws org.openrdf.rio.RDFHandlerException
  11. * If the configured statement handler has encountered an
  12. * unrecoverable error.
  13. */
  14. @Override
  15. public void parse(InputStream in, String baseURI) throws IOException, RDFParseException, RDFHandlerException {
  16. Preconditions.checkNotNull(baseURI);
  17. setBaseURI(baseURI);
  18. WireFeedInput input = new WireFeedInput();
  19. try {
  20. WireFeed feed = input.build(new InputSource(in));
  21. if(feed instanceof Feed) {
  22. parseFeed((Feed) feed);
  23. } else {
  24. throw new RDFParseException("data stream is not an RSS feed");
  25. }
  26. } catch (FeedException e) {
  27. throw new RDFParseException(e);
  28. }
  29. }

代码示例来源:origin: apache/marmotta

  1. /**
  2. * Parses the data from the supplied InputStream, using the supplied baseURI
  3. * to resolve any relative URI references.
  4. *
  5. * @param in The InputStream from which to read the data.
  6. * @param baseURI The URI associated with the data in the InputStream.
  7. * @throws java.io.IOException If an I/O error occurred while data was read from the InputStream.
  8. * @throws org.openrdf.rio.RDFParseException
  9. * If the parser has found an unrecoverable parse error.
  10. * @throws org.openrdf.rio.RDFHandlerException
  11. * If the configured statement handler has encountered an
  12. * unrecoverable error.
  13. */
  14. @Override
  15. public void parse(InputStream in, String baseURI) throws IOException, RDFParseException, RDFHandlerException {
  16. Preconditions.checkNotNull(baseURI);
  17. setBaseURI(baseURI);
  18. WireFeedInput input = new WireFeedInput();
  19. try {
  20. WireFeed feed = input.build(new InputSource(in));
  21. if(feed instanceof Feed) {
  22. parseFeed((Feed) feed);
  23. } else {
  24. throw new RDFParseException("data stream is not an RSS feed");
  25. }
  26. } catch (FeedException e) {
  27. throw new RDFParseException(e);
  28. }
  29. }

代码示例来源:origin: apache/marmotta

  1. /**
  2. * Parses the data from the supplied InputStream, using the supplied baseURI
  3. * to resolve any relative URI references.
  4. *
  5. * @param in The InputStream from which to read the data.
  6. * @param baseURI The URI associated with the data in the InputStream.
  7. * @throws java.io.IOException If an I/O error occurred while data was read from the InputStream.
  8. * @throws org.openrdf.rio.RDFParseException
  9. * If the parser has found an unrecoverable parse error.
  10. * @throws org.openrdf.rio.RDFHandlerException
  11. * If the configured statement handler has encountered an
  12. * unrecoverable error.
  13. */
  14. @Override
  15. public void parse(InputStream in, String baseURI) throws IOException, RDFParseException, RDFHandlerException {
  16. Preconditions.checkNotNull(baseURI);
  17. setBaseURI(baseURI);
  18. WireFeedInput input = new WireFeedInput();
  19. try {
  20. WireFeed feed = input.build(new InputSource(in));
  21. if(feed instanceof Channel) {
  22. parseFeed((Channel) feed);
  23. } else {
  24. throw new RDFParseException("data stream is not an RSS feed");
  25. }
  26. } catch (FeedException e) {
  27. throw new RDFParseException(e);
  28. }
  29. }

代码示例来源:origin: apache/marmotta

  1. /**
  2. * Parses the data from the supplied Reader, using the supplied baseURI to
  3. * resolve any relative URI references.
  4. *
  5. * @param reader The Reader from which to read the data.
  6. * @param baseURI The URI associated with the data in the InputStream.
  7. * @throws java.io.IOException If an I/O error occurred while data was read from the InputStream.
  8. * @throws org.openrdf.rio.RDFParseException
  9. * If the parser has found an unrecoverable parse error.
  10. * @throws org.openrdf.rio.RDFHandlerException
  11. * If the configured statement handler has encountered an
  12. * unrecoverable error.
  13. */
  14. @Override
  15. public void parse(Reader reader, String baseURI) throws IOException, RDFParseException, RDFHandlerException {
  16. Preconditions.checkNotNull(baseURI);
  17. setBaseURI(baseURI);
  18. WireFeedInput input = new WireFeedInput();
  19. try {
  20. WireFeed feed = input.build(reader);
  21. if(feed instanceof Channel) {
  22. parseFeed((Channel) feed);
  23. } else {
  24. throw new RDFParseException("data stream is not an RSS feed");
  25. }
  26. } catch (FeedException e) {
  27. throw new RDFParseException(e);
  28. }
  29. }

代码示例来源:origin: apache/marmotta

  1. /**
  2. * Parses the data from the supplied Reader, using the supplied baseURI to
  3. * resolve any relative URI references.
  4. *
  5. * @param reader The Reader from which to read the data.
  6. * @param baseURI The URI associated with the data in the InputStream.
  7. * @throws java.io.IOException If an I/O error occurred while data was read from the InputStream.
  8. * @throws org.openrdf.rio.RDFParseException
  9. * If the parser has found an unrecoverable parse error.
  10. * @throws org.openrdf.rio.RDFHandlerException
  11. * If the configured statement handler has encountered an
  12. * unrecoverable error.
  13. */
  14. @Override
  15. public void parse(Reader reader, String baseURI) throws IOException, RDFParseException, RDFHandlerException {
  16. Preconditions.checkNotNull(baseURI);
  17. setBaseURI(baseURI);
  18. WireFeedInput input = new WireFeedInput();
  19. try {
  20. WireFeed feed = input.build(reader);
  21. if(feed instanceof Feed) {
  22. parseFeed((Feed) feed);
  23. } else {
  24. throw new RDFParseException("data stream is not an RSS feed");
  25. }
  26. } catch (FeedException e) {
  27. throw new RDFParseException(e);
  28. }
  29. }

代码示例来源:origin: com.bbossgroups/bboss-mvc

  1. @Override
  2. @SuppressWarnings("unchecked")
  3. public T readInternal(Class<? extends T> clazz, HttpInputMessage inputMessage)
  4. throws IOException, HttpMessageNotReadableException {
  5. WireFeedInput feedInput = new WireFeedInput();
  6. MediaType contentType = inputMessage.getHeaders().getContentType();
  7. Charset charset;
  8. if (contentType != null && contentType.getCharSet() != null) {
  9. charset = contentType.getCharSet();
  10. } else {
  11. charset = DEFAULT_CHARSET;
  12. }
  13. try {
  14. Reader reader = new InputStreamReader(inputMessage.getBody(), charset);
  15. return (T) feedInput.build(reader);
  16. }
  17. catch (FeedException ex) {
  18. throw new HttpMessageNotReadableException("Could not read WireFeed: " + ex.getMessage(), ex);
  19. }
  20. }

代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss

  1. /**
  2. * Parse entry from reader.
  3. */
  4. public static Entry parseEntry(Reader rd, String baseURI)
  5. throws JDOMException, IOException, IllegalArgumentException, FeedException {
  6. // Parse entry into JDOM tree
  7. SAXBuilder builder = new SAXBuilder();
  8. Document entryDoc = builder.build(rd);
  9. Element fetchedEntryElement = entryDoc.getRootElement();
  10. fetchedEntryElement.detach();
  11. // Put entry into a JDOM document with 'feed' root so that Rome can handle it
  12. Feed feed = new Feed();
  13. feed.setFeedType("atom_1.0");
  14. WireFeedOutput wireFeedOutput = new WireFeedOutput();
  15. Document feedDoc = wireFeedOutput.outputJDom(feed);
  16. feedDoc.getRootElement().addContent(fetchedEntryElement);
  17. if (baseURI != null) {
  18. feedDoc.getRootElement().setAttribute("base", baseURI, Namespace.XML_NAMESPACE);
  19. }
  20. WireFeedInput input = new WireFeedInput();
  21. Feed parsedFeed = (Feed)input.build(feedDoc);
  22. return (Entry)parsedFeed.getEntries().get(0);
  23. }
  24. }

代码示例来源:origin: apache/marmotta

  1. /**
  2. * Parse entry from reader.
  3. */
  4. public static Entry parseEntry(Reader rd, String baseURI)
  5. throws JDOMException, IOException, IllegalArgumentException, FeedException {
  6. // Parse entry into JDOM tree
  7. SAXBuilder builder = new SAXBuilder();
  8. Document entryDoc = builder.build(rd);
  9. Element fetchedEntryElement = entryDoc.getRootElement();
  10. fetchedEntryElement.detach();
  11. // Put entry into a JDOM document with 'feed' root so that Rome can handle it
  12. Feed feed = new Feed();
  13. feed.setFeedType("atom_1.0");
  14. WireFeedOutput wireFeedOutput = new WireFeedOutput();
  15. Document feedDoc = wireFeedOutput.outputJDom(feed);
  16. feedDoc.getRootElement().addContent(fetchedEntryElement);
  17. if (baseURI != null) {
  18. feedDoc.getRootElement().setAttribute("base", baseURI, Namespace.XML_NAMESPACE);
  19. }
  20. WireFeedInput input = new WireFeedInput();
  21. Feed parsedFeed = (Feed)input.build(feedDoc);
  22. return (Entry)parsedFeed.getEntries().get(0);
  23. }
  24. }

相关文章