Package org.apache.cxf.io

Examples of org.apache.cxf.io.CachedOutputStream


        }
    }
   
   
    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


    }

    private InputStream getInputStream(XMLStreamReader input)
        throws XMLStreamException, IOException {
       
        CachedOutputStream out = new CachedOutputStream();
        try {
            XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out);
            StaxUtils.copy(input, xsw);
            xsw.close();
            return out.getInputStream();
        } finally {
            out.close();
        }
    }
View Full Code Here

        if (SAXSource.class.isAssignableFrom(type)) {
            XMLStreamReader reader = StaxUtils.createXMLStreamReader((Element)input);
            return new StaxSource(reader);
        } else if (StreamSource.class.isAssignableFrom(type)) {
            try {
                CachedOutputStream out = new CachedOutputStream();               
                DOMUtils.writeXml(input, out);
                InputStream is = out.getInputStream();
                out.close();
               
                return new StreamSource(is);
            } catch (IOException e) {
                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
            } catch (TransformerException e) {
View Full Code Here

            buffer.getAddress().append(uri);
        }
           
        InputStream is = message.getContent(InputStream.class);
        if (is != null) {
            CachedOutputStream bos = new CachedOutputStream();
            try {
                IOUtils.copy(is, bos);

                bos.flush();
                is.close();

                message.setContent(InputStream.class, bos.getInputStream());
                if (bos.getTempFile() != null) {
                    //large thing on disk...
                    buffer.getMessage().append("\nMessage (saved to tmp file):\n");
                    buffer.getMessage().append("Filename: " + bos.getTempFile().getAbsolutePath() + "\n");
                }
                if (bos.size() > limit) {
                    buffer.getMessage().append("(message truncated to " + limit + " bytes)\n");
                }
                writePayload(buffer.getPayload(), bos, encoding, ct);
                   
                bos.close();
            } catch (Exception e) {
                throw new Fault(e);
            }
        }
View Full Code Here

    public boolean isCached() {
        return cache != null;
    }
    public void cache() throws IOException {
        if (cache == null) {
            cache = new CachedOutputStream();
            IOUtils.copy(ins, cache);
            cache.lockOutputStream()
            ins.close();
            ins = null;
            if (delegate != null) {
View Full Code Here

    private void cache(DelegatingInputStream input, boolean deleteOnClose) throws IOException {
        if (loaded.contains(input)) {
            return;
        }
        loaded.add(input);
        CachedOutputStream out = null;
        InputStream origIn = input.getInputStream();
        try {
            out = new CachedOutputStream();
            setStreamedAttachmentProperties(out);
            IOUtils.copy(input, out);
            input.setInputStream(out.getInputStream());
            origIn.close();
        } finally {
            if (out != null) {
                out.close();
            }
        }
    }
View Full Code Here

        }
    }
   
   
    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

            post.releaseConnection();
        }
    }
   
    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

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.