Examples of SegmentedByteArray


Examples of com.netflix.zeno.fastblob.record.SegmentedByteArray

            }
        }

        Arrays.sort(populatedReverseKeys);

        SegmentedByteArray arr = byteData.getUnderlyingArray();
        long currentCopyPointer = 0;

        for(int i=0;i<populatedReverseKeys.length;i++) {
            int ordinal = (int)(populatedReverseKeys[i] & 0xFFFFFFF);

            if(usedOrdinals.get(ordinal)) {
                long pointer = populatedReverseKeys[i] >> 28;
                int length = VarInt.readVInt(arr, pointer);
                length += VarInt.sizeOfVInt(length);

                if(currentCopyPointer != pointer)
                    arr.copy(arr, pointer, currentCopyPointer, length);

                populatedReverseKeys[i] = populatedReverseKeys[i] << 36 | currentCopyPointer;

                currentCopyPointer += length;
            } else {
View Full Code Here

Examples of com.netflix.zeno.fastblob.record.SegmentedByteArray

public class SegmentedByteArrayTest {

    @Test
    public void noSuchThingAsOutOfBoundsExceptionWhenWriting() {
        SegmentedByteArray arr = new SegmentedByteArray(3); // each segment is size 8

        for(int i=0;i<1000;i++) {
            arr.set(i, (byte)i);
        }

        for(int i=0;i<1000;i++) {
            Assert.assertEquals((byte)i, arr.get(i));
        }
    }
View Full Code Here

Examples of com.netflix.zeno.fastblob.record.SegmentedByteArray

        }
    }

    @Test
    public void copyToAnotherSegmentedByteArray() {
        SegmentedByteArray src = new SegmentedByteArray(3);

        for(int i=0;i<128;i++) {
            src.set(i, (byte)i);
        }

        SegmentedByteArray dest = new SegmentedByteArray(3);

        for(int i=0;i<(128-32);i++) {
            for(int j=0;j<(128-32);j++) {
                dest.copy(src, i, j, 32);

                for(int k=0;k<32;k++) {
                    Assert.assertEquals((byte)src.get(i+k), (byte)dest.get(j+k));
                }
            }
        }
    }
View Full Code Here

Examples of com.netflix.zeno.fastblob.record.SegmentedByteArray

        }
    }

    @Test
    public void canReferenceLongSpace() {
        SegmentedByteArray arr = new SegmentedByteArray(25);

        arr.set(0x1FFFFFFFFL, (byte)100);

        Assert.assertEquals((byte)100, arr.get(0x1FFFFFFFFL));
    }
View Full Code Here

Examples of com.netflix.zeno.fastblob.record.SegmentedByteArray

    public LazyTypeDataState(NFTypeSerializer<T> serializer, LazyStateEngine lazyStateEngine) {
        this.lazyStateEngine = lazyStateEngine;
        this.serializer = serializer;
        pointersScratch = new HashMap<Integer, Long>();
        this.byteData = new SegmentedByteArray(13);

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