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

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

本文整理了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

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

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

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

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

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

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

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

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

public Feed readFrom(
    Class<Feed> type, 
    Type genericType, 
    Annotation annotations[],
    MediaType mediaType, 
    MultivaluedMap<String, String> httpHeaders, 
    InputStream entityStream) throws IOException {
  try {
    WireFeedInput input = new WireFeedInput();                      
    WireFeed wireFeed = input.build(new InputStreamReader(entityStream));    
    if (!(wireFeed instanceof Feed)) {
      throw new IOException(ImplMessages.ERROR_NOT_ATOM_FEED(type));
    }
    return (Feed)wireFeed;
  } catch (FeedException cause) {
    IOException effect = new IOException(ImplMessages.ERROR_MARSHALLING_ATOM(type));
    effect.initCause(cause);
    throw effect;
  }
}

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

public Feed readFrom(
    Class<Feed> type, 
    Type genericType, 
    Annotation annotations[],
    MediaType mediaType, 
    MultivaluedMap<String, String> httpHeaders, 
    InputStream entityStream) throws IOException {
  try {
    WireFeedInput input = new WireFeedInput();                      
    WireFeed wireFeed = input.build(new InputStreamReader(entityStream));    
    if (!(wireFeed instanceof Feed)) {
      throw new IOException(ImplMessages.ERROR_NOT_ATOM_FEED(type));
    }
    return (Feed)wireFeed;
  } catch (FeedException cause) {
    IOException effect = new IOException(ImplMessages.ERROR_MARSHALLING_ATOM(type));
    effect.initCause(cause);
    throw effect;
  }
}

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

public Feed readFrom(
    Class<Feed> type, 
    Type genericType, 
    Annotation annotations[],
    MediaType mediaType, 
    MultivaluedMap<String, String> httpHeaders, 
    InputStream entityStream) throws IOException {
  try {
    WireFeedInput input = new WireFeedInput();                      
    WireFeed wireFeed = input.build(new InputStreamReader(entityStream));    
    if (!(wireFeed instanceof Feed)) {
      throw new IOException(ImplMessages.ERROR_NOT_ATOM_FEED(type));
    }
    return (Feed)wireFeed;
  } catch (FeedException cause) {
    IOException effect = new IOException(ImplMessages.ERROR_MARSHALLING_ATOM(type));
    effect.initCause(cause);
    throw effect;
  }
}

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

/**
 * Parse entry from InputStream.
 */
private static Entry parseEntry(InputStream in) 
throws JDOMException, IOException, IllegalArgumentException, FeedException {
  // Parse entry into JDOM tree
  SAXBuilder builder = new SAXBuilder();
  Document entryDoc = builder.build(in);
  Element fetchedEntryElement = entryDoc.getRootElement();
  fetchedEntryElement.detach();
  
  // Put entry into a JDOM document with 'feed' root so that Rome can handle it
  Feed feed = new Feed();
  feed.setFeedType(FEED_TYPE);
  WireFeedOutput wireFeedOutput = new WireFeedOutput();
  Document feedDoc = wireFeedOutput.outputJDom(feed);
  feedDoc.getRootElement().addContent(fetchedEntryElement);
      
  WireFeedInput input = new WireFeedInput();
  Feed parsedFeed = (Feed)input.build(feedDoc);
  return (Entry)parsedFeed.getEntries().get(0);
}

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

/**
 * Parse entry from InputStream.
 */
private static Entry parseEntry(InputStream in) 
throws JDOMException, IOException, IllegalArgumentException, FeedException {
  // Parse entry into JDOM tree
  SAXBuilder builder = new SAXBuilder();
  Document entryDoc = builder.build(in);
  Element fetchedEntryElement = entryDoc.getRootElement();
  fetchedEntryElement.detach();
  
  // Put entry into a JDOM document with 'feed' root so that Rome can handle it
  Feed feed = new Feed();
  feed.setFeedType(FEED_TYPE);
  WireFeedOutput wireFeedOutput = new WireFeedOutput();
  Document feedDoc = wireFeedOutput.outputJDom(feed);
  feedDoc.getRootElement().addContent(fetchedEntryElement);
      
  WireFeedInput input = new WireFeedInput();
  Feed parsedFeed = (Feed)input.build(feedDoc);
  return (Entry)parsedFeed.getEntries().get(0);
}

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

/**
 * Parse entry from InputStream.
 */
private static Entry parseEntry(InputStream in) 
throws JDOMException, IOException, IllegalArgumentException, FeedException {
  // Parse entry into JDOM tree
  SAXBuilder builder = new SAXBuilder();
  Document entryDoc = builder.build(in);
  Element fetchedEntryElement = entryDoc.getRootElement();
  fetchedEntryElement.detach();
  
  // Put entry into a JDOM document with 'feed' root so that Rome can handle it
  Feed feed = new Feed();
  feed.setFeedType(FEED_TYPE);
  WireFeedOutput wireFeedOutput = new WireFeedOutput();
  Document feedDoc = wireFeedOutput.outputJDom(feed);
  feedDoc.getRootElement().addContent(fetchedEntryElement);
      
  WireFeedInput input = new WireFeedInput();
  Feed parsedFeed = (Feed)input.build(feedDoc);
  return (Entry)parsedFeed.getEntries().get(0);
}

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

/**
   * Parse entry from reader.
   */
  public static Entry parseEntry(Reader rd, String baseURI)
    throws JDOMException, IOException, IllegalArgumentException, FeedException {
    // Parse entry into JDOM tree
    SAXBuilder builder = new SAXBuilder();
    Document entryDoc = builder.build(rd);
    Element fetchedEntryElement = entryDoc.getRootElement();
    fetchedEntryElement.detach();

    // Put entry into a JDOM document with 'feed' root so that Rome can handle it
    Feed feed = new Feed();
    feed.setFeedType("atom_1.0");
    WireFeedOutput wireFeedOutput = new WireFeedOutput();
    Document feedDoc = wireFeedOutput.outputJDom(feed);
    feedDoc.getRootElement().addContent(fetchedEntryElement);
    
    if (baseURI != null) {
      feedDoc.getRootElement().setAttribute("base", baseURI, Namespace.XML_NAMESPACE);
    }
    
    WireFeedInput input = new WireFeedInput();
    Feed parsedFeed = (Feed)input.build(feedDoc);
    return (Entry)parsedFeed.getEntries().get(0);
  } 
}

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

/**
   * Parse entry from reader.
   */
  public static Entry parseEntry(Reader rd, String baseURI)
    throws JDOMException, IOException, IllegalArgumentException, FeedException {
    // Parse entry into JDOM tree
    SAXBuilder builder = new SAXBuilder();
    Document entryDoc = builder.build(rd);
    Element fetchedEntryElement = entryDoc.getRootElement();
    fetchedEntryElement.detach();

    // Put entry into a JDOM document with 'feed' root so that Rome can handle it
    Feed feed = new Feed();
    feed.setFeedType("atom_1.0");
    WireFeedOutput wireFeedOutput = new WireFeedOutput();
    Document feedDoc = wireFeedOutput.outputJDom(feed);
    feedDoc.getRootElement().addContent(fetchedEntryElement);
    
    if (baseURI != null) {
      feedDoc.getRootElement().setAttribute("base", baseURI, Namespace.XML_NAMESPACE);
    }
    
    WireFeedInput input = new WireFeedInput();
    Feed parsedFeed = (Feed)input.build(feedDoc);
    return (Entry)parsedFeed.getEntries().get(0);
  } 
}

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

/**
 * Parses the data from the supplied InputStream, using the supplied baseURI
 * to resolve any relative URI references.
 *
 * @param in      The InputStream from which to read the data.
 * @param baseURI The URI associated with the data in the InputStream.
 * @throws java.io.IOException If an I/O error occurred while data was read from the InputStream.
 * @throws org.openrdf.rio.RDFParseException
 *                             If the parser has found an unrecoverable parse error.
 * @throws org.openrdf.rio.RDFHandlerException
 *                             If the configured statement handler has encountered an
 *                             unrecoverable error.
 */
@Override
public void parse(InputStream in, String baseURI) throws IOException, RDFParseException, RDFHandlerException {
  Preconditions.checkNotNull(baseURI);
  setBaseURI(baseURI);
  WireFeedInput input = new WireFeedInput();
  try {
    WireFeed feed = input.build(new InputSource(in));
    if(feed instanceof Feed) {
      parseFeed((Feed) feed);
    } else {
      throw new RDFParseException("data stream is not an RSS feed");
    }
  } catch (FeedException e) {
    throw new RDFParseException(e);
  }
}

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

/**
 * Parses the data from the supplied InputStream, using the supplied baseURI
 * to resolve any relative URI references.
 *
 * @param in      The InputStream from which to read the data.
 * @param baseURI The URI associated with the data in the InputStream.
 * @throws java.io.IOException If an I/O error occurred while data was read from the InputStream.
 * @throws org.openrdf.rio.RDFParseException
 *                             If the parser has found an unrecoverable parse error.
 * @throws org.openrdf.rio.RDFHandlerException
 *                             If the configured statement handler has encountered an
 *                             unrecoverable error.
 */
@Override
public void parse(InputStream in, String baseURI) throws IOException, RDFParseException, RDFHandlerException {
  Preconditions.checkNotNull(baseURI);
  setBaseURI(baseURI);
  WireFeedInput input = new WireFeedInput();
  try {
    WireFeed feed = input.build(new InputSource(in));
    if(feed instanceof Feed) {
      parseFeed((Feed) feed);
    } else {
      throw new RDFParseException("data stream is not an RSS feed");
    }
  } catch (FeedException e) {
    throw new RDFParseException(e);
  }
}

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

/**
 * Parses the data from the supplied InputStream, using the supplied baseURI
 * to resolve any relative URI references.
 *
 * @param in      The InputStream from which to read the data.
 * @param baseURI The URI associated with the data in the InputStream.
 * @throws java.io.IOException If an I/O error occurred while data was read from the InputStream.
 * @throws org.openrdf.rio.RDFParseException
 *                             If the parser has found an unrecoverable parse error.
 * @throws org.openrdf.rio.RDFHandlerException
 *                             If the configured statement handler has encountered an
 *                             unrecoverable error.
 */
@Override
public void parse(InputStream in, String baseURI) throws IOException, RDFParseException, RDFHandlerException {
  Preconditions.checkNotNull(baseURI);
  setBaseURI(baseURI);
  WireFeedInput input = new WireFeedInput();
  try {
    WireFeed feed = input.build(new InputSource(in));
    if(feed instanceof Channel) {
      parseFeed((Channel) feed);
    } else {
      throw new RDFParseException("data stream is not an RSS feed");
    }
  } catch (FeedException e) {
    throw new RDFParseException(e);
  }
}

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

/**
 * Parses the data from the supplied Reader, using the supplied baseURI to
 * resolve any relative URI references.
 *
 * @param reader  The Reader from which to read the data.
 * @param baseURI The URI associated with the data in the InputStream.
 * @throws java.io.IOException If an I/O error occurred while data was read from the InputStream.
 * @throws org.openrdf.rio.RDFParseException
 *                             If the parser has found an unrecoverable parse error.
 * @throws org.openrdf.rio.RDFHandlerException
 *                             If the configured statement handler has encountered an
 *                             unrecoverable error.
 */
@Override
public void parse(Reader reader, String baseURI) throws IOException, RDFParseException, RDFHandlerException {
  Preconditions.checkNotNull(baseURI);
  setBaseURI(baseURI);
  WireFeedInput input = new WireFeedInput();
  try {
    WireFeed feed = input.build(reader);
    if(feed instanceof Channel) {
      parseFeed((Channel) feed);
    } else {
      throw new RDFParseException("data stream is not an RSS feed");
    }
  } catch (FeedException e) {
    throw new RDFParseException(e);
  }
}

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

/**
 * Parses the data from the supplied Reader, using the supplied baseURI to
 * resolve any relative URI references.
 *
 * @param reader  The Reader from which to read the data.
 * @param baseURI The URI associated with the data in the InputStream.
 * @throws java.io.IOException If an I/O error occurred while data was read from the InputStream.
 * @throws org.openrdf.rio.RDFParseException
 *                             If the parser has found an unrecoverable parse error.
 * @throws org.openrdf.rio.RDFHandlerException
 *                             If the configured statement handler has encountered an
 *                             unrecoverable error.
 */
@Override
public void parse(Reader reader, String baseURI) throws IOException, RDFParseException, RDFHandlerException {
  Preconditions.checkNotNull(baseURI);
  setBaseURI(baseURI);
  WireFeedInput input = new WireFeedInput();
  try {
    WireFeed feed = input.build(reader);
    if(feed instanceof Feed) {
      parseFeed((Feed) feed);
    } else {
      throw new RDFParseException("data stream is not an RSS feed");
    }
  } catch (FeedException e) {
    throw new RDFParseException(e);
  }
}

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

@Override
@SuppressWarnings("unchecked")
public T readInternal(Class<? extends T> clazz, HttpInputMessage inputMessage)
    throws IOException, HttpMessageNotReadableException {
  WireFeedInput feedInput = new WireFeedInput();
  MediaType contentType = inputMessage.getHeaders().getContentType();
  Charset charset;
  if (contentType != null && contentType.getCharSet() != null) {
    charset = contentType.getCharSet();
  } else {
    charset = 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);
  }
}

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

/**
   * Parse entry from reader.
   */
  public static Entry parseEntry(Reader rd, String baseURI)
    throws JDOMException, IOException, IllegalArgumentException, FeedException {
    // Parse entry into JDOM tree
    SAXBuilder builder = new SAXBuilder();
    Document entryDoc = builder.build(rd);
    Element fetchedEntryElement = entryDoc.getRootElement();
    fetchedEntryElement.detach();

    // Put entry into a JDOM document with 'feed' root so that Rome can handle it
    Feed feed = new Feed();
    feed.setFeedType("atom_1.0");
    WireFeedOutput wireFeedOutput = new WireFeedOutput();
    Document feedDoc = wireFeedOutput.outputJDom(feed);
    feedDoc.getRootElement().addContent(fetchedEntryElement);
    
    if (baseURI != null) {
      feedDoc.getRootElement().setAttribute("base", baseURI, Namespace.XML_NAMESPACE);
    }
    
    WireFeedInput input = new WireFeedInput();
    Feed parsedFeed = (Feed)input.build(feedDoc);
    return (Entry)parsedFeed.getEntries().get(0);
  } 
}

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

/**
   * Parse entry from reader.
   */
  public static Entry parseEntry(Reader rd, String baseURI)
    throws JDOMException, IOException, IllegalArgumentException, FeedException {
    // Parse entry into JDOM tree
    SAXBuilder builder = new SAXBuilder();
    Document entryDoc = builder.build(rd);
    Element fetchedEntryElement = entryDoc.getRootElement();
    fetchedEntryElement.detach();

    // Put entry into a JDOM document with 'feed' root so that Rome can handle it
    Feed feed = new Feed();
    feed.setFeedType("atom_1.0");
    WireFeedOutput wireFeedOutput = new WireFeedOutput();
    Document feedDoc = wireFeedOutput.outputJDom(feed);
    feedDoc.getRootElement().addContent(fetchedEntryElement);
    
    if (baseURI != null) {
      feedDoc.getRootElement().setAttribute("base", baseURI, Namespace.XML_NAMESPACE);
    }
    
    WireFeedInput input = new WireFeedInput();
    Feed parsedFeed = (Feed)input.build(feedDoc);
    return (Entry)parsedFeed.getEntries().get(0);
  } 
}

相关文章