Package org.elasticsearch.common.util

Examples of org.elasticsearch.common.util.ByteArray


        // TODO: delegate to BigArrays via:
        // return bigarrays.equals(bytearray, other.bytearray);
        // and for slices:
        // return bigarrays.equals(bytearray, start, other.bytearray, otherstart, len);
        ByteArray otherArray = other.bytearray;
        int otherOffset = other.offset;
        for (int i = 0; i < length; i++) {
            if (bytearray.get(offset + i) != otherArray.get(otherOffset + i)) {
                return false;
            }
        }
        return true;
    }
View Full Code Here


        // TODO: delegate to BigArrays via:
        // return bigarrays.equals(bytearray, other.bytearray);
        // and for slices:
        // return bigarrays.equals(bytearray, start, other.bytearray, otherstart, len);
        ByteArray otherArray = other.bytearray;
        int otherOffset = other.offset;
        for (int i = 0; i < length; i++) {
            if (bytearray.get(offset + i) != otherArray.get(otherOffset + i)) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

        assertEquals(sliceJdkHash, sliceHash);
    }

    public void testEquals() {
        int length = randomIntBetween(100, PAGE_SIZE * randomIntBetween(2, 5));
        ByteArray ba1 = bigarrays.newByteArray(length, false);
        ByteArray ba2 = bigarrays.newByteArray(length, false);

        // copy contents
        for (long i = 0; i < length; i++) {
            ba2.set(i, ba1.get(i));
        }

        // get refs & compare
        BytesReference pbr = new PagedBytesReference(bigarrays, ba1, length);
        BytesReference pbr2 = new PagedBytesReference(bigarrays, ba2, length);
View Full Code Here

        assertEquals(pbr, ba);
    }

    public void testSliceEquals() {
        int length = randomIntBetween(100, PAGE_SIZE * randomIntBetween(2, 5));
        ByteArray ba1 = bigarrays.newByteArray(length, false);
        BytesReference pbr = new PagedBytesReference(bigarrays, ba1, length);

        // test equality of slices
        int sliceFrom = randomIntBetween(0, pbr.length());
        int sliceLength = randomIntBetween(pbr.length() - sliceFrom, pbr.length() - sliceFrom);
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.util.ByteArray

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.