hollow/src/main/java/com/netflix/hollow/core/memory/SegmentedByteArray.java
public void orderedCopy(SegmentedByteArray src, long srcPos, long destPos, long length) {
        int segmentLength = 1 << log2OfSegmentSize;
        int currentSegment = (int)(destPos >>> log2OfSegmentSize);
        int segmentStartPos = (int)(destPos & bitmask);
        int remainingBytesInSegment = segmentLength - segmentStartPos;

        while(length > 0) {
            int bytesToCopyFromSegment = (int)Math.min(remainingBytesInSegment, length);
            ensureCapacity(currentSegment);
            int copiedBytes = src.orderedCopy(srcPos, segments[currentSegment], segmentStartPos, bytesToCopyFromSegment);

            srcPos += copiedBytes;
            length -= copiedBytes;
            segmentStartPos = 0;
            remainingBytesInSegment = segmentLength;
            currentSegment++;
        }
    }
public void orderedCopy(SegmentedByteArray src, long srcPos, long destPos, long length) {
        int segmentLength = 1 << log2OfSegmentSize;
        int currentSegment = (int)(destPos >>> log2OfSegmentSize);
        int segmentStartPos = (int)(destPos & bitmask);
        int remainingBytesInSegment = segmentLength - segmentStartPos;

        while(length > 0) {
            int bytesToCopyFromSegment = (int)Math.min(remainingBytesInSegment, length);
            ensureCapacity(currentSegment);
            int copiedBytes = src.orderedCopy(srcPos, segments[currentSegment], segmentStartPos, bytesToCopyFromSegment);

            srcPos += copiedBytes;
            length -= copiedBytes;
            segmentStartPos = 0;
            remainingBytesInSegment = segmentLength;
            currentSegment++;
        }
    }
public void orderedCopy ( SegmentedByteArray src , long srcPos , long destPos , long length ) { int segmentLength = 1 << log2OfSegmentSize ; int currentSegment = ( int ) ( destPos >>> log2OfSegmentSize ) ; int segmentStartPos = ( int ) ( destPos & bitmask ) ; int remainingBytesInSegment = segmentLength - segmentStartPos ; while ( length > 0 ) { int bytesToCopyFromSegment = ( int ) Math . min ( remainingBytesInSegment , length ) ; ensureCapacity ( currentSegment ) ; int copiedBytes = src . orderedCopy ( srcPos , segments [ currentSegment ] , segmentStartPos , bytesToCopyFromSegment ) ; srcPos += copiedBytes ; length -= copiedBytes ; segmentStartPos = 0 ; remainingBytesInSegment = segmentLength ; currentSegment ++ ; } }
Copies the data from the provided source array into this array, guaranteeing that
if the update is seen by another thread, then all other writes prior to this call
are also visible to that thread.

@param src the source data
@param srcPos the position to begin copying from the source data
@param destPos the position to begin writing in this array
@param length the length of the data to copy
Copies the data from the provided source array into this array guaranteeing that if the update is seen by another thread then all other writes prior to this call are also visible to that thread .