Return the {@link ByteBuf} stored at the given index of the array.
555411
private ByteBuf buffer(int i) {
        ByteBuf b = buffers[i];
        return b instanceof Component ? ((Component) b).buf : b;
    }
917357
@Override
  public Byte set(int index, Byte element) {
    return set(index, element.byteValue());
  }
414654
@Override
    public V get(ByteBuffer b, int offset, int len) {
        int t = 0;
        for (int i = 0; i < len; i++) {
            byte c = b.get(offset + i);
            int index = __lookup[c & 0x7f];
            if (index >= 0) {
                int idx = t * ROW_SIZE + index;
                t = _rowIndex[idx];
                if (t == 0)
                    return null;
            } else {
                char[] big = _bigIndex == null ? null : _bigIndex[t];
                if (big == null)
                    return null;
                t = big[c];
                if (t == 0)
                    return null;
            }
        }
        return (V) _value[t];
    }
880923
@Nullable
  public byte [] getAsByteArray ()
  {
    try (final NonBlockingByteArrayOutputStream aBAOS = new NonBlockingByteArrayOutputStream ())
    {
      if (writeTo (aBAOS).isFailure ())
        return null;
      return aBAOS.getBufferOrCopy ();
    }
  }
709875
public synchronized void returnBuf(byte[] buf) {
        if (buf == null || buf.length > mSizeLimit) {
            return;
        }
        mBuffersByLastUse.add(buf);
        int pos = Collections.binarySearch(mBuffersBySize, buf, BUF_COMPARATOR);
        if (pos < 0) {
            pos = -pos - 1;
        }
        mBuffersBySize.add(pos, buf);
        mCurrentSize += buf.length;
        trim();
    }
650356
private ByteBuf tryCompress(ByteBuf buf) {
        final int uncompressedLength = buf.readableBytes();
        final byte[] compressed = new byte[Snappy.maxCompressedLength(uncompressedLength)];
        final int compressedLength;

        if (buf.hasArray()) {
            // Save a memory copy by reading directly from the backing array.
            compressedLength = Snappy.compress(
                    buf.array(), buf.arrayOffset() + buf.readerIndex(), uncompressedLength, compressed, 0);
        } else {
            final byte[] data = new byte[buf.readableBytes()];
            buf.getBytes(buf.readerIndex(), data);
            compressedLength = Snappy.compress(data, 0, data.length, compressed, 0);
        }

        final double ratio = (double) compressedLength / uncompressedLength;
        if (ratio > minCompressionRatio) {
            // Compression doesn't make enough of a difference.
            return null;
        }

        // Save a memory copy by deferring trimming until we know the result will be used.
        final byte[] trimmedCompressed = Arrays.copyOf(compressed, compressedLength);
        return Unpooled.wrappedBuffer(trimmedCompressed);
    }
484061
public static byte[] getIndexArray(int length) {
        byte[] index = new byte[length];
        for (int i=0; i<index.length; i++) {
            index[i] = (byte) i;
        }
        return index;
    }
1151170
public ByteBuffer get4x3Transposed(int index, ByteBuffer buffer) {
        MemUtil.INSTANCE.put4x3Transposed(this, index, buffer);
        return buffer;
    }
730351
public ByteBuffer toByteBuffer(int index, int length)
    {
        checkPositionIndexes(index, index + length, this.length);
        index += offset;
        return ByteBuffer.wrap(data, index, length).order(LITTLE_ENDIAN);
    }
534138
@Override
    public byte[] getBytes(int columnIndex) throws SQLException {
        checkColumnBounds(columnIndex);
        try {
            if (table.getColumnType(columnIndex - 1) == VoltType.STRING)
                return table.getStringAsBytes(columnIndex - 1);
            else if (table.getColumnType(columnIndex - 1) == VoltType.VARBINARY)
                return table.getVarbinary(columnIndex - 1);
            else
                throw SQLError.get(SQLError.CONVERSION_NOT_FOUND,
                        table.getColumnType(columnIndex - 1), "byte[]");
        } catch (SQLException x) {
            throw x;
        } catch (Exception x) {
            throw SQLError.get(x);
        }
    }
275404
final ByteBuffer readPointer(int index) {
    int pointerOffset = computePointerOffset(index);
    return sliceOutRange(pointerOffset, pointerOffset + POINTER_SIZE_BYTES);
  }
1274969
public byte getValueAsByte(int index) throws IOException {
        if (index >= structure.valueSizes.size()) {
            throw new IOException("Index " + index + " is out of range.");
        }
        return value[index];
    }
531510
@Override
    public byte get(int index) {
        Preconditions.checkElementIndex(index, this.length, "index");
        return this.array[index + this.startOffset];
    }
139113
public ByteBuffer get(int index, ByteBuffer dest) {
        MemUtil.INSTANCE.put(this, index, dest);
        return dest;
    }
474799
public ByteBuffer get4x3Transposed(int index, ByteBuffer dest) {
        MemUtil.INSTANCE.put4x3Transposed(this, index, dest);
        return dest;
    }
760273
public byte get(int index) throws IndexOutOfBoundsException
    {
        if (index < 0 || mLength <= index)
        {
            // Bad index.
            throw new IndexOutOfBoundsException(
                    String.format("Bad index: index=%d, length=%d", index, mLength));
        }

        return mBuffer.get(index);
    }
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");
        }
    }