public Pair<Integer, Integer> parseRowKey(byte[] lineBytes, int length)
      throws BadTsvLineException {
      int rkColumnIndex = 0;
      int startPos = 0, endPos = 0;
      for (int i = 0; i <= length; i++) {
        if (i == length || lineBytes[i] == separatorByte) {
          endPos = i - 1;
          if (rkColumnIndex++ == getRowKeyColumnIndex()) {
            if ((endPos + 1) == startPos) {
              throw new BadTsvLineException("Empty value for ROW KEY.");
            }
            break;
          } else {
            startPos = endPos + 2;
          }
        }
        if (i == length) {
          throw new BadTsvLineException("Row key does not exist as number of columns in the line"
            + " are less than row key position.");
        }
      }
      return new Pair<>(startPos, endPos - startPos + 1);
    }
Return starting position and length of row key from the specified line bytes.
@return Pair of row key offset and length.
hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/ImportTsv.java