Package org.apache.axiom.attachments.utils

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


        for (int i=0; i<ITERATIONS+PRIME; i++) {
            if (i == PRIME) {
                time = System.currentTimeMillis();
            }
            inputBAIS.reset();
            BAAOutputStream baaos = new BAAOutputStream();
            BufferUtils.inputStream2OutputStream(inputBAIS, baaos);
            assertTrue("1: " + baaos.length() + " " + INPUT_SIZE, baaos.length() == INPUT_SIZE);

            BAAInputStream baais = new BAAInputStream(baaos.buffers(), baaos.length());
            baaos = new BAAOutputStream();
            BufferUtils.inputStream2OutputStream(baais, baaos);
            baais = new BAAInputStream(baaos.buffers(), baaos.length());
            baaos = new BAAOutputStream();
            for (int j= 1; j < 1000; j++) {
                baaos.write(baais.read());
            }
            BufferUtils.inputStream2OutputStream(baais, baaos);
            assertTrue("" + baaos.length() + " " + INPUT_SIZE, baaos.length() == INPUT_SIZE);
        }
        //System.out.println("Enhanced time = " + (System.currentTimeMillis()-time));
    }
View Full Code Here


                    // 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);
                    partContent = 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) {
                        partContent = 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());

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

TOP

Related Classes of org.apache.axiom.attachments.utils.BAAOutputStream

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.