private String readLocaleFrom()

in library/src/main/java/com/whatsapp/stringpacks/MMappedStringPack.java [90:104]


  private String readLocaleFrom(@IntRange(from = 0) int offset) {
    final int length;
    mappedByteBuffer.position(offset);
    int localePosition = mappedByteBuffer.position();
    if (mappedByteBuffer.get(localePosition + 2) == '\0') {
      length = 2;
    } else if (mappedByteBuffer.get(localePosition + 5) == '\0') {
      length = 5;
    } else {
      length = StringPackData.LOCALE_CODE_SIZE;
    }
    byte[] stringBytes = new byte[length];
    mappedByteBuffer.get(stringBytes, 0, stringBytes.length);
    return new String(stringBytes, 0, stringBytes.length, StringPackData.ASCII);
  }