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