Java 8 Source - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Source class.

This code example shows how to use the following methods: setSystemId
 * @author Joni Freeman 
 */ 
public class SpecdoxTransformer { 
    public void transform(String filename, String specXmlDir, String outputDir, File xref) throws TransformerException {
        Source xmlSource = new StreamSource(new StringReader("<?xml version=\"1.0\" ?><foo></foo>"));
        Source xsltSource = new StreamSource(Specdox.class.getResourceAsStream("/specdox.xsl"));
        xsltSource.setSystemId("/specdox.xsl");
         
        TransformerFactory transFact = new TransformerFactoryImpl();
        Transformer trans = transFact.newTransformer(xsltSource);
        trans.setParameter("spec-file-dir", specXmlDir);
        trans.setParameter("xref", xref.getName());
        trans.setParameter("output-dir", outputDir);
        trans.setParameter("frameset-index-filename", filename);
        trans.transform(xmlSource, new StreamResult(System.out));
    } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setSystemId
        ep.publish("test");
        assertTrue("The endpoint was not published successfully", ep.isPublished());
         
        String wsdlLocation = "http://test.wsdl.com/Test.wsdl"; // Dummy URL
        List<Source> metadata = new ArrayList<Source>();
        Source source = new StreamSource(new ByteArrayInputStream(new byte[0])); // Dummy content  
        source.setSystemId(wsdlLocation);  
        metadata.add(source);
        ep.setMetadata(metadata);
         
        metadata = ep.getMetadata();
        assertNotNull(metadata);
        source = metadata.get(0);
        assertNotNull(source);
        assertEquals(source.getSystemId(), wsdlLocation);
         
        ep.stop();
    } 
 
    public void testCreateAndPublishOnAlternatePort() throws Exception {
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getSystemId
                if (source instanceof StreamSource) {
                    StreamSource stream = (StreamSource) source;
                    InputSource inputStream = new InputSource(stream.getInputStream());
                    inputStream.setCharacterStream(inputStream.getCharacterStream());
                    inputStream.setPublicId(stream.getPublicId());
                    inputStream.setSystemId(source.getSystemId());
                    source = new SAXSource(saxParserFactory.provide().newSAXParser().getXMLReader(), inputStream);
                } 
 
                StreamResult sr = new StreamResult(entityStream);
                transformerFactory.provide().newTransformer().transform(source, sr);
 
            } catch (SAXException ex) {
                throw new InternalServerErrorException(ex);
            } catch (ParserConfigurationException ex) {
                throw new InternalServerErrorException(ex);
            } catch (TransformerException ex) {
                throw new InternalServerErrorException(ex);
            } 
        } 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setSystemId
httpClient.executeMethod(get);
                    byte[] body = get.getResponseBody();
                    Element element = new Element(newUrl, body);
                    cache.put(element);
                    toReturn = new StreamSource(new BufferedInputStream(new ByteArrayInputStream(
                            body)));
                } 
                catch (HttpException e)
                { 
                    e.printStackTrace();
                    logger.error(e.getLocalizedMessage());
                    return null; 
                } 
                catch (IOException e)
                { 
                    e.printStackTrace();
                    logger.error(e.getLocalizedMessage());
                    return null; 
                } 

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getClass, getSystemId
    public static void doWithSource(Source source, SourceCallback callback) throws Exception {
        if (source instanceof DOMSource) {
            callback.domSource(((DOMSource) source).getNode());
            return; 
        } 
        else if (StaxUtils.isStaxSource(source)) {
            XMLStreamReader streamReader = StaxUtils.getXMLStreamReader(source);
            if (streamReader != null) {
                callback.staxSource(streamReader);
                return; 
            } 
            else { 
                XMLEventReader eventReader = StaxUtils.getXMLEventReader(source);
                if (eventReader != null) {
                    callback.staxSource(eventReader);
                    return; 
                } 
            } 
        } 
        else if (source instanceof SAXSource) {

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Java 8 Source Questions & Answers:

See Code Examples for Java 8 Source Methods: