Package org.apache.cxf.io

Examples of org.apache.cxf.io.CachedOutputStream


                    testFeature.faultInInterceptorCalled());
        }
    }

    private String getStringFromInputStream(InputStream in) throws Exception {       
        CachedOutputStream bos = new CachedOutputStream();
        IOUtils.copy(in, bos);
        String str = new String(bos.getBytes());
        in.close();
        bos.close();
        return str;
    }
View Full Code Here


            //cache this inputstream since it's defer to use in case of async
            try {
                InputStream in = inMessage.getContent(InputStream.class);
                if (in != null) {
                    CachedOutputStream cos = new CachedOutputStream();
                    IOUtils.copy(in, cos);
                    inMessage.setContent(InputStream.class, cos.getInputStream());
                }
                incomingObserver.onMessage(inMessage);
            } catch (IOException e) {
                e.printStackTrace();
            }
View Full Code Here

        }
    }
   
   
    private String getStringFromInputStream(InputStream in) throws Exception {       
        CachedOutputStream bos = new CachedOutputStream();
        IOUtils.copy(in, bos);
        in.close();
        bos.close();
        return bos.getOut().toString();       
    }
View Full Code Here

        if (enabled) {
            boolean streamingOn = InjectionUtils.invokeBooleanGetter(w, "getEnableStreaming");
            if (streamingOn) {
                m.setContent(XMLStreamWriter.class, new CachingXmlEventWriter());
            } else {
                m.setContent(OutputStream.class, new CachedOutputStream());
            }
        }
        return enabled;
    }
View Full Code Here

            return;
        }
        if (enabled) {
            OutputStream os = m.getContent(OutputStream.class);
            if (os != osOriginal && os instanceof CachedOutputStream) {
                CachedOutputStream cos = (CachedOutputStream)os;
                if (cos.size() != 0) {
                    cos.writeCacheTo(osOriginal);
                }
            }
        }
    }
View Full Code Here

                    testFeature.faultInInterceptorCalled());
        }
    }

    private String getStringFromInputStream(InputStream in) throws Exception {       
        CachedOutputStream bos = new CachedOutputStream();
        IOUtils.copy(in, bos);
        in.close();
        bos.close();
        return bos.getOut().toString();       
    }
View Full Code Here

            //cache this inputstream since it's defer to use in case of async
            try {
                InputStream in = inMessage.getContent(InputStream.class);
                if (in != null) {
                    CachedOutputStream cos = new CachedOutputStream();
                    IOUtils.copy(in, cos);
                    inMessage.setContent(InputStream.class, cos.getInputStream());
                }
                incomingObserver.onMessage(inMessage);
            } catch (IOException e) {
                e.printStackTrace();
            }
View Full Code Here

            //cache this inputstream since it's defer to use in case of async
            try {
                InputStream in = inMessage.getContent(InputStream.class);
                if (in != null) {
                    CachedOutputStream cos = new CachedOutputStream();
                    IOUtils.copy(in, cos);
                    inMessage.setContent(InputStream.class, cos.getInputStream());
                }
                incomingObserver.onMessage(inMessage);
            } catch (IOException e) {
                e.printStackTrace();
            }
View Full Code Here

    private final String ct;   
    private final CachedOutputStream cache;
   
    public AttachmentDataSource(String ctParam, InputStream inParam) throws IOException {
        this.ct = ctParam;       
        cache = new CachedOutputStream();
        IOUtils.copy(inParam, cache);
        cache.lockOutputStream();
    }
View Full Code Here

    public Object read(QName name, XMLStreamReader input, Class type) {
        if (type != null) {
            if (SAXSource.class.isAssignableFrom(type)) {
                try {
                    CachedOutputStream out = new CachedOutputStream();
                    try {
                        XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out);
                        StaxUtils.copy(input, xsw);
                        xsw.close();
                        return new SAXSource(new InputSource(out.getInputStream()));
                    } finally {
                        out.close();
                    }
                } catch (IOException e) {
                    throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
                } catch (XMLStreamException e) {
                    throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
                }
            } else if (StreamSource.class.isAssignableFrom(type)) {
                try {
                    CachedOutputStream out = new CachedOutputStream();
                    try {
                        XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out);
                        StaxUtils.copy(input, xsw);
                        xsw.close();
                        return new StreamSource(out.getInputStream());
                    } finally {
                        out.close();
                    }
                } catch (IOException e) {
                    throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
                } catch (XMLStreamException e) {
                    throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
View Full Code Here

TOP

Related Classes of org.apache.cxf.io.CachedOutputStream

Copyright © 2018 www.massapicom. 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.