in library/src/main/java/com/whatsapp/stringpacks/StringPacks.java [169:188]
static ParsedStringPack loadData(
@NonNull Context context, @NonNull String fileName, @NonNull Locale locale) {
ParsedStringPack result = null;
String resourcePackFileName = fileName + PACK_FILE_EXTENSION;
try {
MappedByteBuffer mappedByteBuffer = null;
File extractedPackFile =
extractPackFile(context, fileName, context.getResources(), resourcePackFileName);
RandomAccessFile randomAccessFile = new RandomAccessFile(extractedPackFile, "r");
FileChannel fileChannel = randomAccessFile.getChannel();
mappedByteBuffer =
fileChannel.map(FileChannel.MapMode.READ_ONLY, 0, extractedPackFile.length());
final List<String> parentLocales = getParentLocales(locale);
result = new ParsedStringPack(parentLocales, mappedByteBuffer);
} catch (IOException exception) {
SpLog.e("translations/loadData error:" + exception);
}
return result;
}