protected byte[] getValue(ByteBuffer buffer) {
    int extrasLength = buffer.get(EXTRAS_LENGTH_INDEX);
    int totalBodyLength = buffer.getInt(TOTAL_BODY_LENGTH_INDEX);
    int keyLength = buffer.getShort(KEY_LENGTH_INDEX);
    int valueLength = totalBodyLength - (keyLength + extrasLength);
    byte[] value = new byte[valueLength];
    buffer.position(HEADER_LENGTH + totalBodyLength - valueLength);
    if (getLogger().finerEnabled()) {
      getLogger().finer("val: totalBody:" + totalBodyLength + " valLen:" + valueLength);
    }
    buffer.get(value);
    // for (int i=0; i<valueLength; i++) {
    // value[i] = buffer.get();
    // }
    if (getLogger().finerEnabled()) {
      getLogger().finer("val:" + Arrays.toString(value) + " totalBody:" + totalBodyLength
          + " valLen:" + valueLength);
    }
    return value;
  }
A buffer to read and decode the first line.
geode-memcached/src/main/java/org/apache/geode/internal/memcached/commands/AbstractCommand.java