Examples of BAAOutputStream


Examples of org.apache.axiom.attachments.utils.BAAOutputStream

                // If this is the root part, keep it in memory.

                // Get the bytes of the data without a lot
                // of resizing and GC.  The BAAOutputStream
                // keeps the data in non-contiguous byte buffers.
                BAAOutputStream baaos = new BAAOutputStream();
                BufferUtils.inputStream2OutputStream(in, baaos);
                return new PartContentOnMemory(baaos.buffers(), baaos.length());
            } else {
                // We need to read the input stream to determine whether
                // the size is bigger or smaller than the threshold.
                BAAOutputStream baaos = new BAAOutputStream();
                int count = BufferUtils.inputStream2OutputStream(in, baaos, thresholdSize);

                if (count < thresholdSize) {
                    return new PartContentOnMemory(baaos.buffers(), baaos.length());
                } else {
                    // A BAAInputStream is an input stream over a list of non-contiguous 4K buffers.
                    BAAInputStream baais =
                        new BAAInputStream(baaos.buffers(), baaos.length());

                    return new PartContentOnFile(manager,
                                          baais,
                                          in,
                                          attachmentDir);
View Full Code Here

Examples of org.apache.axiom.attachments.utils.BAAOutputStream

    public OMDataSourceExt copy() {
        if(log.isDebugEnabled()){
            log.debug("Enter ParserInputStreamDataSource.copy()");
        }
        try {
            BAAOutputStream baaos = new BAAOutputStream();
            BufferUtils.inputStream2OutputStream(data.readParserInputStream(), baaos);
            BAAInputStream baais = new BAAInputStream(baaos.buffers(),
                        baaos.length());
           
            if (log.isDebugEnabled()) {
                log.debug("Exit ParserInputStreamDataSource.copy()");
            }
            return new ParserInputStreamDataSource(baais, data.encoding, data.behavior);
View Full Code Here

Examples of org.apache.axiom.attachments.utils.BAAOutputStream

                    try {
                        if(log.isDebugEnabled()){
                            log.debug("The inputStream does not supports mark().  Copying Stream");
                        }
                        // make a non-contiguous resettable input stream
                        BAAOutputStream baaos = new BAAOutputStream();
                        BufferUtils.inputStream2OutputStream(inputStream, baaos);
                        BAAInputStream baais = new BAAInputStream(baaos.buffers(),
                                    baaos.length());
                        payload = baais;
                        payload.mark(Integer.MAX_VALUE);
                    } catch (Throwable t) {
                        if(log.isDebugEnabled()){
                            log.debug("Error:", t);
View Full Code Here

Examples of org.apache.axiom.attachments.utils.BAAOutputStream

     * @throws IOException
     */
    public void detach() throws IOException {
        if (localStream == null && !isClosed) {

            BAAOutputStream baaos = new BAAOutputStream();
            try {
                // It is possible that the underlying stream was closed
                BufferUtils.inputStream2OutputStream(in, baaos);
                super.close();
            } catch (Throwable t) {
                if (log.isDebugEnabled()) {
                    log.debug("detach caught exception.  Processing continues:"
                              + t);
                    log.debug("  " + stackToString(t));
                }
            } finally {
                in = null; // GC the incoming stream
            }
           
            localStream = new BAAInputStream(baaos.buffers(), baaos.length());
            if (log.isDebugEnabled()) {
                log.debug("The local stream built from the detached " +
                                "stream has a length of:" + baaos.length());
            }
            count = count + baaos.length();
        }
    }
View Full Code Here

Examples of org.apache.axiom.attachments.utils.BAAOutputStream

                // If this is a SOAPPart, keep it in memory.
               
                // Get the bytes of the data without a lot
                // of resizing and GC.  The BAAOutputStream
                // keeps the data in non-contiguous byte buffers.
                BAAOutputStream baaos = new BAAOutputStream();
                BufferUtils.inputStream2OutputStream(dross, baaos);
                BufferUtils.inputStream2OutputStream(in, baaos);
                return new PartOnMemoryEnhanced(headers, baaos.buffers(), baaos.length());
            } else {
                // We need to read the input stream to determine whether
                // the size is bigger or smaller than the threshhold.
                BAAOutputStream baaos = new BAAOutputStream();
                int t1 = BufferUtils.inputStream2OutputStream(dross, baaos, threshholdSize);
                int t2 =  BufferUtils.inputStream2OutputStream(in, baaos, threshholdSize - t1);
                int total = t1 + t2;
               
                if (total < threshholdSize) {
                    return new PartOnMemoryEnhanced(headers, baaos.buffers(), baaos.length());
                } else {
                    // A BAAInputStream is an input stream over a list of non-contiguous 4K buffers.
                    BAAInputStream baais =
                        new BAAInputStream(baaos.buffers(), baaos.length());
                   
                    return new PartOnFile(manager, headers,
                                          baais,
                                          in,
                                          attachmentDir);
View Full Code Here

Examples of org.apache.axiom.attachments.utils.BAAOutputStream

    public OMDataSourceExt copy() {
        if(log.isDebugEnabled()){
            log.debug("Enter ParserInputStreamDataSource.copy()");
        }
        try {
            BAAOutputStream baaos = new BAAOutputStream();
            BufferUtils.inputStream2OutputStream(data.readParserInputStream(), baaos);
            BAAInputStream baais = new BAAInputStream(baaos.buffers(),
                        baaos.length());
           
            if (log.isDebugEnabled()) {
                log.debug("Exit ParserInputStreamDataSource.copy()");
            }
            return new ParserInputStreamDataSource(baais, data.encoding, data.behavior);
View Full Code Here

Examples of org.apache.axiom.attachments.utils.BAAOutputStream

                    try {
                        if(log.isDebugEnabled()){
                            log.debug("The inputStream does not supports mark().  Copying Stream");
                        }
                        // make a non-contiguous resettable input stream
                        BAAOutputStream baaos = new BAAOutputStream();
                        BufferUtils.inputStream2OutputStream(inputStream, baaos);
                        BAAInputStream baais = new BAAInputStream(baaos.buffers(),
                                    baaos.length());
                        payload = baais;
                        payload.mark(Integer.MAX_VALUE);
                    } catch (Throwable t) {
                        if(log.isDebugEnabled()){
                            log.debug("Error:", t);
View Full Code Here

Examples of org.apache.axiom.attachments.utils.BAAOutputStream

                    // If this is a SOAPPart, keep it in memory.

                    // Get the bytes of the data without a lot
                    // of resizing and GC.  The BAAOutputStream
                    // keeps the data in non-contiguous byte buffers.
                    BAAOutputStream baaos = new BAAOutputStream();
                    BufferUtils.inputStream2OutputStream(dross, baaos);
                    BufferUtils.inputStream2OutputStream(in, baaos);
                    part = new PartOnMemoryEnhanced(headers, baaos.buffers(), baaos.length());
                } else {
                    // We need to read the input stream to determine whether
                    // the size is bigger or smaller than the threshold.
                    BAAOutputStream baaos = new BAAOutputStream();
                    int t1 = BufferUtils.inputStream2OutputStream(dross, baaos, thresholdSize);
                    int t2 =  BufferUtils.inputStream2OutputStream(in, baaos, thresholdSize - t1);
                    int total = t1 + t2;

                    if (total < thresholdSize) {
                        return new PartOnMemoryEnhanced(headers, baaos.buffers(), baaos.length());
                    } else {
                        // A BAAInputStream is an input stream over a list of non-contiguous 4K buffers.
                        BAAInputStream baais =
                            new BAAInputStream(baaos.buffers(), baaos.length());

                        part = new PartOnFile(manager, headers,
                                              baais,
                                              in,
                                              attachmentDir);
View Full Code Here

Examples of org.apache.axiom.attachments.utils.BAAOutputStream

     * @throws IOException
     */
    public void detach() throws IOException {
        if (localStream == null && !isClosed) {

            BAAOutputStream baaos = new BAAOutputStream();
            try {
                // It is possible that the underlying stream was closed
                BufferUtils.inputStream2OutputStream(in, baaos);
                super.close();
            } catch (Throwable t) {
                if (log.isDebugEnabled()) {
                    log.debug("detach caught exception.  Processing continues:"
                              + t);
                    log.debug("  " + stackToString(t));
                }
            } finally {
                in = null; // GC the incoming stream
            }
           
            localStream = new BAAInputStream(baaos.buffers(), baaos.length());
            if (log.isDebugEnabled()) {
                log.debug("The local stream built from the detached " +
                                "stream has a length of:" + baaos.length());
            }
            count = count + baaos.length();
        }
    }
View Full Code Here

Examples of org.apache.axiom.attachments.utils.BAAOutputStream

                // If this is a SOAPPart, keep it in memory.
               
                // Get the bytes of the data without a lot
                // of resizing and GC.  The BAAOutputStream
                // keeps the data in non-contiguous byte buffers.
                BAAOutputStream baaos = new BAAOutputStream();
                BufferUtils.inputStream2OutputStream(dross, baaos);
                BufferUtils.inputStream2OutputStream(in, baaos);
                return new PartOnMemoryEnhanced(headers, baaos.buffers(), baaos.length());
            } else {
                // We need to read the input stream to determine whether
                // the size is bigger or smaller than the threshhold.
                BAAOutputStream baaos = new BAAOutputStream();
                int t1 = BufferUtils.inputStream2OutputStream(dross, baaos, threshholdSize);
                int t2 =  BufferUtils.inputStream2OutputStream(in, baaos, threshholdSize - t1);
                int total = t1 + t2;
               
                if (total < threshholdSize) {
                    return new PartOnMemoryEnhanced(headers, baaos.buffers(), baaos.length());
                } else {
                    // A BAAInputStream is an input stream over a list of non-contiguous 4K buffers.
                    BAAInputStream baais =
                        new BAAInputStream(baaos.buffers(), baaos.length());
                   
                    return new PartOnFile(manager, headers,
                                          baais,
                                          in,
                                          attachmentDir);
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.