Package xbird.util.io

Examples of xbird.util.io.FastMultiByteArrayOutputStream


        }

        private void pageOutSegments(final FixedSegments paged, final int beginPage, final int endPage)
                throws IOException {
            final int[][] blockRef = _block;
            final FastMultiByteArrayOutputStream buf = new FastMultiByteArrayOutputStream(DEFAULT_EXTENT_SIZE);
            for(int i = beginPage; i <= endPage; i += DEFAULT_EXTENT_THRESHOLD) {
                final int pages;
                if((i + DEFAULT_EXTENT_THRESHOLD - 1) > endPage) {
                    break;
                } else {
                    pages = DEFAULT_EXTENT_THRESHOLD;
                }
                int addr = i;
                final int limit = Math.min(i + pages, blockRef.length - 1);
                for(int p = i; p < limit; p++) {
                    final int[] ref = blockRef[p];
                    if(ref == null) {
                        if(buf.size() > 0) {
                            final byte[] b = buf.toByteArray();
                            buf.reset();
                            paged.bulkWrite(addr, b);
                        }
                    } else {
                        if(buf.size() == 0) {
                            addr = p;
                        }
                        buf.writeInts(ref, 0, ref.length);
                        blockRef[p] = null;
                    }
                }
                if(buf.size() > 0) {
                    final byte[] b = buf.toByteArray();
                    buf.reset();
                    paged.bulkWrite(i, b);
                }
            }
            buf.close();
            paged.flush(false);
            if(LOG.isInfoEnabled()) {
                LOG.info("paged out docuemnt table seqment(" + beginPage + " - " + endPage
                        + ") to disk: " + paged.getFile().getAbsolutePath());
            }
View Full Code Here


            return seq;
        }
    }

    private static XQEventDecoder pipedIn(ObjectInput in, boolean reaccessable) throws IOException {
        final FastMultiByteArrayOutputStream bufOut = new FastMultiByteArrayOutputStream(BUFFERING_BLOCK_SIZE);
        final ObjectOutputStream objectOut = new ObjectOutputStream(bufOut);
        final XQEventDecoder decoder = new XQEventDecoder(in);
        decoder.redirectTo(objectOut);
        objectOut.flush();

        final byte[][] buf = bufOut.toMultiByteArray();
        final int totalBufSize = bufOut.size();
        bufOut.clear();

        // Because input of decoder fully read, this section required for re-object serialization, etc.
        final FastMultiByteArrayInputStream inputBuf = new FastMultiByteArrayInputStream(buf, BUFFERING_BLOCK_SIZE, totalBufSize);
        if(!reaccessable) {
            inputBuf.setCleanable(true);
View Full Code Here

TOP

Related Classes of xbird.util.io.FastMultiByteArrayOutputStream

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.