Exemplo n.º 1
0
  public int get(int index) {
    if (index < 0 || index >= limit) {
      throw new IndexOutOfBoundsException();
    }

    int bytePtr = arrayOffset + (index << 2);
    if (isDirect) {
      return ByteBufferImpl._getInt(bytePtr);
    } else if (array != null) {
      return array[arrayOffset + index];
    } else {
      return parent.getInt(bytePtr);
    }
  }
Exemplo n.º 2
0
  public IntBuffer put(int index, int i) {
    if (index < 0 || index >= limit) {
      throw new IndexOutOfBoundsException();
    }

    int bytePtr = arrayOffset + (index << 2);
    if (isDirect) {
      ByteBufferImpl._putInt(bytePtr, i);
    } else if (array != null) {
      array[arrayOffset + index] = i;
    } else {
      parent.putInt(bytePtr, i);
    }
    return this;
  }