@Converter public XMLEventReader createXMLEventReader(InputStream in, Exchange exchange) throws XMLStreamException { XMLInputFactory factory = getInputFactory(); try { return factory.createXMLEventReader(IOHelper.buffered(in), IOHelper.getCharsetName(exchange)); } finally { returnXMLInputFactory(factory); } }
@Converter public XMLEventWriter createXMLEventWriter(OutputStream out, Exchange exchange) throws XMLStreamException { XMLOutputFactory factory = getOutputFactory(); try { return factory.createXMLEventWriter( IOHelper.buffered(out), IOHelper.getCharsetName(exchange)); } finally { returnXMLOutputFactory(factory); } }
@Converter public XMLEventReader createXMLEventReader(File file, Exchange exchange) throws XMLStreamException, FileNotFoundException { XMLInputFactory factory = getInputFactory(); try { return factory.createXMLEventReader( IOHelper.buffered(new FileInputStream(file)), IOHelper.getCharsetName(exchange)); } finally { returnXMLInputFactory(factory); } }
/** * Loads all the class entries from the JAR. * * @param stream the inputstream of the jar file to be examined for classes * @param urlPath the url of the jar file to be examined for classes * @return all the .class entries from the JAR */ private List<String> doLoadJarClassEntries(InputStream stream, String urlPath) { List<String> entries = new ArrayList<String>(); JarInputStream jarStream = null; try { jarStream = new JarInputStream(stream); JarEntry entry; while ((entry = jarStream.getNextJarEntry()) != null) { String name = entry.getName(); if (name != null) { name = name.trim(); if (!entry.isDirectory() && name.endsWith(".class")) { entries.add(name); } } } } catch (IOException ioe) { log.warn( "Cannot search jar file '" + urlPath + " due to an IOException: " + ioe.getMessage(), ioe); } finally { IOHelper.close(jarStream, urlPath, log); } return entries; }
@Converter public XMLEventWriter createXMLEventWriter(Writer writer) throws XMLStreamException { XMLOutputFactory factory = getOutputFactory(); try { return factory.createXMLEventWriter(IOHelper.buffered(writer)); } finally { returnXMLOutputFactory(factory); } }
@Converter public XMLEventReader createXMLEventReader(Reader reader) throws XMLStreamException { XMLInputFactory factory = getInputFactory(); try { return factory.createXMLEventReader(IOHelper.buffered(reader)); } finally { returnXMLInputFactory(factory); } }
/** @deprecated will be removed in Camel 3.0. Use the method which has 2 parameters. */ @Deprecated public XMLEventReader createXMLEventReader(InputStream in) throws XMLStreamException { XMLInputFactory factory = getInputFactory(); try { return factory.createXMLEventReader(IOHelper.buffered(in)); } finally { returnXMLInputFactory(factory); } }