Examples of LoadingByteArrayOutputStream


Examples of org.apache.cxf.helpers.LoadingByteArrayOutputStream

        }
    }

    private void tryRemote(String uriStr) throws IOException {
        try {
            LoadingByteArrayOutputStream bout = cache.get(uriStr);
            url = new URL(uriStr);
            uri = new URI(url.toString());
            if (bout == null) {
                URLConnection connection = url.openConnection();
                is = connection.getInputStream();
                bout = new LoadingByteArrayOutputStream(1024);
                IOUtils.copy(is, bout);
                is.close();
                cache.put(uriStr, bout);
            }
            is = bout.createInputStream();
        } catch (MalformedURLException e) {
            // do nothing
        } catch (URISyntaxException e) {
            // do nothing
        }
View Full Code Here

Examples of org.apache.cxf.helpers.LoadingByteArrayOutputStream

         * Perform any actions required on stream closure (handle response etc.)
         */
        public void close() throws IOException {
            if (buffer != null && buffer.size() > 0) {
                thresholdNotReached();
                LoadingByteArrayOutputStream tmp = buffer;
                buffer = null;
                super.write(tmp.getRawBytes(), 0, tmp.size());
            }
            if (!written) {
                handleHeadersTrustCaching();
            }
            super.flush();
View Full Code Here

Examples of org.apache.cxf.helpers.LoadingByteArrayOutputStream

                    if (baseURI == null) {
                        baseURI = si.getSystemId();
                    }
                    DOMSource ds = new DOMSource(el, baseURI);  
                    schemaSourcesMap2.put(si.getSystemId() + ":" + si.getNamespaceURI(), ds);
                    LoadingByteArrayOutputStream out = new LoadingByteArrayOutputStream();
                    StaxUtils.copy(el, StaxUtils.createXMLStreamWriter(out));
                    schemaSourcesMap.put(si.getSystemId() + ":" + si.getNamespaceURI(), out.toByteArray());
                }

               
                for (XmlSchema sch : serviceInfo.getXmlSchemaCollection().getXmlSchemas()) {
                    if (sch.getSourceURI() != null
                        && !schemaSourcesMap.containsKey(sch.getSourceURI() + ":"
                                                         + sch.getTargetNamespace())) {
                       
                        InputStream ins = null;
                        try {
                            URL url = new URL(sch.getSourceURI());
                            ins = url.openStream();
                        } catch (Exception e) {
                            //ignore, we'll just use what we have.  (though
                            //bugs in XmlSchema could make this less useful)
                        }
                       
                        LoadingByteArrayOutputStream out = new LoadingByteArrayOutputStream();
                        if (ins == null) {
                            sch.write(out);
                        } else {
                            IOUtils.copyAndCloseInput(ins, out);
                        }

                        schemaSourcesMap.put(sch.getSourceURI() + ":"
                                             + sch.getTargetNamespace(), out.toByteArray());
                       
                        Source source = new StreamSource(out.createInputStream(), sch.getSourceURI());
                        schemaSourcesMap2.put(sch.getSourceURI() + ":"
                                              + sch.getTargetNamespace(), source);
                    }
                }
View Full Code Here

Examples of org.apache.cxf.helpers.LoadingByteArrayOutputStream

         */
        public void close() throws IOException {
            try {
                if (buffer != null && buffer.size() > 0) {
                    thresholdNotReached();
                    LoadingByteArrayOutputStream tmp = buffer;
                    buffer = null;
                    super.write(tmp.getRawBytes(), 0, tmp.size());
                }
                if (!written) {
                    handleHeadersTrustCaching();
                }
                if (!cachingForRetransmission) {
View Full Code Here

Examples of org.apache.cxf.helpers.LoadingByteArrayOutputStream

         */
        public void close() throws IOException {
            try {
                if (buffer != null && buffer.size() > 0) {
                    thresholdNotReached();
                    LoadingByteArrayOutputStream tmp = buffer;
                    buffer = null;
                    super.write(tmp.getRawBytes(), 0, tmp.size());
                }
                if (!written) {
                    handleHeadersTrustCaching();
                }
                if (!cachingForRetransmission) {
View Full Code Here

Examples of org.apache.cxf.helpers.LoadingByteArrayOutputStream

        currentStream = new PipedOutputStream(stream);
        inmem = true;
    }

    public CachedOutputStream() {
        currentStream = new LoadingByteArrayOutputStream(2048);
        inmem = true;
    }
View Full Code Here

Examples of org.apache.cxf.helpers.LoadingByteArrayOutputStream

        inmem = true;
    }

    public CachedOutputStream(long threshold) {
        this.threshold = threshold;
        currentStream = new LoadingByteArrayOutputStream(2048);
        inmem = true;
    }
View Full Code Here

Examples of org.apache.cxf.helpers.LoadingByteArrayOutputStream

                        //ignore, we'll just use what we have.  (though
                        //bugs in XmlSchema could make this less useful)
                    }
                   
                    if (ins == null) {
                        LoadingByteArrayOutputStream out = new LoadingByteArrayOutputStream();
                        sch.write(out);
                        ins = out.createInputStream();
                    }
                    impl.setByteStream(ins);
                    return impl;
                }
            }
View Full Code Here

Examples of org.apache.cxf.helpers.LoadingByteArrayOutputStream

                    if (baseURI == null) {
                        baseURI = si.getSystemId();
                    }
                    DOMSource ds = new DOMSource(el, baseURI);  
                    schemaSourcesMap2.put(si.getSystemId() + ":" + si.getNamespaceURI(), ds);
                    LoadingByteArrayOutputStream out = new LoadingByteArrayOutputStream();
                    XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(out);
                    StaxUtils.copy(el, writer);
                    writer.flush();
                    schemaSourcesMap.put(si.getSystemId() + ":" + si.getNamespaceURI(), out.toByteArray());
                }

               
                for (XmlSchema sch : serviceInfo.getXmlSchemaCollection().getXmlSchemas()) {
                    if (sch.getSourceURI() != null
                        && !schemaSourcesMap.containsKey(sch.getSourceURI() + ":"
                                                         + sch.getTargetNamespace())) {
                       
                        InputStream ins = null;
                        try {
                            URL url = new URL(sch.getSourceURI());
                            ins = url.openStream();
                        } catch (Exception e) {
                            //ignore, we'll just use what we have.  (though
                            //bugs in XmlSchema could make this less useful)
                        }
                       
                        LoadingByteArrayOutputStream out = new LoadingByteArrayOutputStream();
                        if (ins == null) {
                            sch.write(out);
                        } else {
                            IOUtils.copyAndCloseInput(ins, out);
                        }

                        schemaSourcesMap.put(sch.getSourceURI() + ":"
                                             + sch.getTargetNamespace(), out.toByteArray());
                       
                        Source source = new StreamSource(out.createInputStream(), sch.getSourceURI());
                        schemaSourcesMap2.put(sch.getSourceURI() + ":"
                                              + sch.getTargetNamespace(), source);
                    }
                }
View Full Code Here

Examples of org.apache.cxf.helpers.LoadingByteArrayOutputStream

        currentStream = new PipedOutputStream(stream);
        inmem = true;
    }

    public CachedOutputStream() {
        currentStream = new LoadingByteArrayOutputStream(2048);
        inmem = true;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.