Sets the specified 64-bit long integer at the specified absolute
{@code index} in this buffer.

@throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or
{@code index + 8} is greater than {@code this.capacity}
356529
public void setLong(int index, long value)
    {
        checkPositionIndexes(index, index + SIZE_OF_LONG, this.length);
        index += offset;
        data[index] = (byte) (value);
        data[index + 1] = (byte) (value >>> 8);
        data[index + 2] = (byte) (value >>> 16);
        data[index + 3] = (byte) (value >>> 24);
        data[index + 4] = (byte) (value >>> 32);
        data[index + 5] = (byte) (value >>> 40);
        data[index + 6] = (byte) (value >>> 48);
        data[index + 7] = (byte) (value >>> 56);
    }
253205
@Deprecated
    protected void set(long index, long length, Pointer from, long inc) {


        long offset = getElementSize() * index;
        if (offset >= length() * getElementSize())
            throw new IllegalArgumentException(
                            "Illegal offset " + offset + " with index of " + index + " and length " + length());

        // TODO: fix this
        throw new UnsupportedOperationException("Deprecated set() call");
    }
611674
void checkIndex(int index, int fieldLength) {
		if (isOutOfBounds(index, fieldLength, capacity())) {
			throw new IndexOutOfBoundsException(
					String.format("index: %d, length: %d (expected: range(0, %d))", index, fieldLength, capacity()));
		}
	}
719142
public static void set(Object baseObject, long baseOffset, int index) {
    assert index >= 0 : "index (" + index + ") should >= 0";
    final long mask = 1L << (index & 0x3f);  // mod 64 and shift
    final long wordOffset = baseOffset + (index >> 6) * WORD_SIZE;
    final long word = Platform.getLong(baseObject, wordOffset);
    Platform.putLong(baseObject, wordOffset, word | mask);
  }
1235984
public void add(int index, Object element) {

        if (index == size()) {
            add(element);    //Add to the end of this.
        }

        //If index > size() an exception should be thrown with a slightly
        //different message than the exception thrown by getInternal.
        else if (index > size()) {
            throw new IndexOutOfBoundsException("Index out of bounds: "
                                                + index + " > " + size());
        } else {
            Node current = getInternal(index);
            Node newNext = new Node(current.data, current.next);

            current.data = element;
            current.next = newNext;

            elementCount++;

            //If they inserted at the last valid index, then a new last element
            //was created, therfore update the last pointer
            if (last == current) {
                last = newNext;
            }
        }
    }
1084670
public boolean set(final int index, final ByteBuffer buf) {
		if (!validState) {
			throw new InvalidStateException();
		}
		if (log.isDebugEnabled()) {
			log.debug("set(" + index + "," + buf + ")");
		}
		try {
			if (buf.limit() > blockSize) {
				log.error("ERROR: buffer.capacity=" + buf.limit() + " > blocksize=" + blockSize);
			}
			if (useMmap) {
				final MappedByteBuffer mbb = getMmapForIndex(index);
				if (mbb != null) {
					mbb.put(buf);
					return true;
				}
				// Fallback to RAF
			}
			fileChannel.position(index * blockSize).write(buf);
			return true;
		} catch (Exception e) {
			log.error("Exception in set(" + index + ")", e);
		}
		return false;
	}
963650
public void putLong(int pos, long l) {
		adaptSize(pos + 8);
		ByteBuffer bb = getBuffer(pos);
		int index = pos % _bufferSize;
		if (bb.limit() - index >= 8) {
			bb.putLong(index, l);
		} else {
			byte b0 = (byte)l;
			byte b1 = (byte)(l >> 8);
			byte b2 = (byte)(l >> 16);
			byte b3 = (byte)(l >> 24);
			byte b4 = (byte)(l >> 32);
			byte b5 = (byte)(l >> 40);
			byte b6 = (byte)(l >> 48);
			byte b7 = (byte)(l >> 56);
			
			if (_order == ByteOrder.BIG_ENDIAN) {
				putBytes(pos, b7, b6, b5, b4, b3, b2, b1, b0);
			} else {
				putBytes(pos, b0, b1, b2, b3, b4, b5, b6, b7);
			}
		}
	}
51005
private int offset(long index) {
    int offset = (int) (index % buffer.length);
    if (offset < 0) {
      offset += buffer.length;
    }
    return offset;
  }
21831
private static final long gatherLongLE(final byte[] data, final int index) {
        int i1 = gatherIntLE(data, index);
        long l2 = gatherIntLE(data, index + 4);

        return uintToLong(i1) | (l2 << 32);
    }
25236
public int setInt(
        @DoNotSub final int index,
        final int element)
    {
        checkIndex(index);

        final int previous = elements[index];
        elements[index] = element;

        return previous;
    }
140734
public void set(long startIndex, long endIndex)
    {
        if (endIndex <= startIndex) return;

        int startWord = (int) (startIndex >> 6);

        // since endIndex is one past the end, this is index of the last
        // word to be changed.
        int endWord = expandingWordNum(endIndex - 1);

        long startmask = -1L << startIndex;
        long endmask = -1L >>> -endIndex; // 64-(endIndex&0x3f) is the same as -endIndex
                                          // due to wrap

        if (startWord == endWord)
        {
            bits[startWord] |= (startmask & endmask);
            return;
        }

        bits[startWord] |= startmask;
        Arrays.fill(bits, startWord + 1, endWord, -1L);
        bits[endWord] |= endmask;
    }
558186
public void putLong(long i) {
        _buffer[_offset++] = (byte) (i >>> 56);
        _buffer[_offset++] = (byte) ((i >> 48) & 0xff);
        _buffer[_offset++] = (byte) ((i >> 40) & 0xff);
        _buffer[_offset++] = (byte) ((i >> 32) & 0xff);
        _buffer[_offset++] = (byte) ((i >> 24) & 0xff);
        _buffer[_offset++] = (byte) ((i >> 16) & 0xff);
        _buffer[_offset++] = (byte) ((i >> 8) & 0xff);
        _buffer[_offset++] = (byte) (i & 0xff);
    }
666154
public void set(int idx, char chr)
    {
        if ( idx < 0 )
            throw new IndexOutOfBoundsException("idx < 0");
        if ( idx >= count )
            throw new IndexOutOfBoundsException("idx >= buffer.length");
        
        buff[idx] = chr;
    }
828677
public synchronized void setSize(int newSize) {

        if (newSize < 0) {
            throw new ArrayIndexOutOfBoundsException(newSize);
        } else if (newSize > buf.length) {
            buf = copyOf(buf, Math.max(buf.length << 1, newSize));
        }

        count = newSize;
    }
1307938
public synchronized void setValue(int i, int value) {

        if (i < 0 || i >= count) {
            throw new IndexOutOfBoundsException();
        }

        if (sortOnValues) {
            sorted = false;
        }

        values[i] = value;
    }
255897
public void set(long index, Block value)
    {
        Block currentValue = array.get(index);
        if (currentValue != null) {
            currentValue.retainedBytesForEachPart((object, size) -> {
                if (currentValue == object) {
                    // track instance size separately as the reference count for an instance is always 1
                    sizeOfBlocks -= size;
                    return;
                }
                if (trackedObjects.decrementAndGet(object) == 0) {
                    // decrement the size only when it is the last reference
                    sizeOfBlocks -= size;
                }
            });
        }
        if (value != null) {
            value.retainedBytesForEachPart((object, size) -> {
                if (value == object) {
                    // track instance size separately as the reference count for an instance is always 1
                    sizeOfBlocks += size;
                    return;
                }
                if (trackedObjects.incrementAndGet(object) == 1) {
                    // increment the size only when it is the first reference
                    sizeOfBlocks += size;
                }
            });
        }
        array.set(index, value);
    }
639679
public WrappedByteBuffer putLongAt(int index, long v) {
        _checkForWriteAt(index, 8);
        _buf.putLong(index, v);
        return this;
    }