private static int findNextSymbolBeginningOffsetFrom_UTF8(long numberOfStartByte,
                                                            RandomAccessFile randomAccessFile) throws IOException {
    final int maxSymbolLengthInUtf8 = 4;
    randomAccessFile.seek(numberOfStartByte);
    int offset = 0;
    byte _byte;
    for (int i = 0; i < maxSymbolLengthInUtf8; i++) {
      try {
        _byte = randomAccessFile.readByte();
      }
      catch (EOFException e) {
        return offset;
      }
      if ((_byte & 0xC0) != 0x80) // _byte != (10xx xxxx)
      {
        return offset;
      }

      offset += 1;
    }

    logger.warn("Can't decode file correctly in UTF-8. There are more than 3 bytes one after another, which match bit mask 10xxxxxx");
    return 0;
  }
private static int findNextSymbolBeginningOffsetFrom_UTF8(long numberOfStartByte,
                                                            RandomAccessFile randomAccessFile)