Serializes the fields common to all sense-key-specific data.

@param byteBuffer where the serialized fields will be stored
@param index the position of the first byte of the sense data descriptor in the {@link ByteBuffer}
422586
private final void serializeCommonFields (final ByteBuffer byteBuffer, final int index) {
        byteBuffer.position(index);
        byte b = 0;
        if (senseKeySpecificDataValid) b = BitManip.getByteWithBitSet(b, 7, true);// set MSB to 1
        byteBuffer.put(b);
    }
275404
final ByteBuffer readPointer(int index) {
    int pointerOffset = computePointerOffset(index);
    return sliceOutRange(pointerOffset, pointerOffset + POINTER_SIZE_BYTES);
  }
1297702
public byte[] getByteArrayValue(int index)
   {
      byte[] result = null;

      if (m_array[index] != null)
      {
         result = (byte[]) m_array[index];
      }

      return (result);
   }
392427
public ByteBuffer getKey(int index) throws IOException {
        if (index >= structure.keySizes.size()) {
            throw new IOException("Index " + index + " is out of range.");
        }
        int length = structure.keySizes.get(index);
        return ByteBuffer.wrap(key, structure.keyByteOffsets.get(index), length).asReadOnlyBuffer();
    }
346751
public ByteBuffer getElement(ByteBuffer serializedList, int index)
    {
        try
        {
            ByteBuffer input = serializedList.duplicate();
            int n = readCollectionSize(input, Server.VERSION_3);
            if (n <= index)
                return null;

            for (int i = 0; i < index; i++)
            {
                int length = input.getInt();
                input.position(input.position() + length);
            }
            return readValue(input, Server.VERSION_3);
        }
        catch (BufferUnderflowException e)
        {
            throw new MarshalException("Not enough bytes to read a list");
        }
    }
606889
@Override
	protected void serializeTo(RawDataBuffer out)
    {
    	super.serializeTo(out);
        out.writeInt(browserId.asInt());
    }
200139
public void setBytes(long memoryOffset, byte[] buffer, int bufferOffset, int count)
    {
        if (buffer == null)
            throw new NullPointerException();
        else if (bufferOffset < 0
                 || count < 0
                 || bufferOffset + count > buffer.length)
            throw new IndexOutOfBoundsException();
        else if (count == 0)
            return;

        long end = memoryOffset + count;
        checkBounds(memoryOffset, end);

        unsafe.copyMemory(buffer, BYTE_ARRAY_BASE_OFFSET + bufferOffset, null, peer + memoryOffset, count);
    }
9379
public void put(ByteArray source, int index, int length)
    {
        put(source.mBuffer.array(), index, length);
    }
584555
public byte getKeyAsByte(int index) throws IOException {
        if (index >= structure.keySizes.size()) {
            throw new IOException("Index " + index + " is out of range.");
        }
        return key[structure.keyByteOffsets.get(index)];
    }
1226564
public void write(byte bbuf[], int off, int len) {
        if ((off < 0) || (off > bbuf.length) || (len < 0) ||
            ((off + len) > bbuf.length) || ((off + len) < 0)) {
            throw new IndexOutOfBoundsException();
        } else if (len == 0) {
            return;
        }
        buf.append(new String(bbuf, off, len));
    }
554630
private void writePointer(int index, ByteBuffer pointer) {
    int limit = memoryBuffer.limit();
    int pos = memoryBuffer.position();
    int pointerOffset = computePointerOffset(index);
    memoryBuffer.limit(pointerOffset + POINTER_SIZE_BYTES);
    memoryBuffer.position(pointerOffset);
    memoryBuffer.put(pointer);
    memoryBuffer.limit(limit);
    memoryBuffer.position(pos);
  }
832367
@Override
    public synchronized void write (byte[] bytes, long storageIndex) throws IOException {
        final int bucketIndex = (int) (storageIndex / SIZE_PER_BUCKET);
        final int bucketOffset = (int) (storageIndex % SIZE_PER_BUCKET);
        try {

            // // DEBUG CODE
            // writer.write(bucketIndex + "," + storageIndex + "," +
            // bucketOffset + "," + bytes.length +
            // "\n");
            // writer.flush();

            byte[] data = mByteCache.getIfPresent(bucketIndex);
            if (data == null) {
                data = getAndprefetchBuckets(bucketIndex);
            }

            System.arraycopy(bytes, 0, data, bucketOffset, bytes.length + bucketOffset > SIZE_PER_BUCKET ? SIZE_PER_BUCKET - bucketOffset
                    : bytes.length);
            storeBucket(bucketIndex, data);
            mByteCache.put(bucketIndex, data);

            if (bucketOffset + bytes.length > SIZE_PER_BUCKET) {
                data = mByteCache.getIfPresent(bucketIndex + 1);
                if (data == null) {
                    data = getAndprefetchBuckets(bucketIndex + 1);
                }

                System.arraycopy(bytes, SIZE_PER_BUCKET - bucketOffset, data, 0, bytes.length - (SIZE_PER_BUCKET - bucketOffset));
                storeBucket(bucketIndex + 1, data);
                mByteCache.put(bucketIndex + 1, data);
            }
        } catch (ExecutionException | InterruptedException exc) {
            throw new IOException(exc);
        }
    }
648888
public byte getByte(final long index)
    {
        if (SHOULD_BOUNDS_CHECK)
        {
            boundsCheck(index);
        }

        return UNSAFE.getByte(null, addressOffset + index);
    }
166223
public ByteBuffer getValue(int index) throws IOException {
        if (index >= structure.valueSizes.size()) {
            throw new IOException("Index " + index + " is out of range.");
        }
        int length = structure.valueSizes.get(index);
        return ByteBuffer.wrap(value, structure.valueByteOffsets.get(index), length).asReadOnlyBuffer();
    }
302651
public void write(final AbstractIndex index)
		throws IOException
	{

		StringBuilder cmd;

		while (index.size() > 0) {

			System.out.println("Transmit Index [" + index + "]");

			cmd = index.remove();
			// System.out.println(cmd.toString());

			cmd.append("\r\n");
			writer.write(cmd.toString());
		}

		writer.flush();
	}
973996
public WrappedByteBuffer putAt(int index, byte v) {
        _checkForWriteAt(index, 1);
        _buf.put(index, v);
        return this;
    }
758443
public void set(int index, byte value) {
        Preconditions.checkState(!this.readOnly, "Cannot modify a read-only ByteArraySegment.");
        Preconditions.checkElementIndex(index, this.length, "index");
        this.array[index + this.startOffset] = value;
    }