MCPcopy Create free account
hub / github.com/M66B/FairEmail / getWord

Method getWord

app/src/main/java/eu/faircode/email/BIP39.java:48–63  ·  view source on GitHub ↗
(@NonNull Locale locale, int index, Context context)

Source from the content-addressed store, hash-verified

46 }
47
48 private static String getWord(@NonNull Locale locale, int index, Context context) {
49 String lang = locale.getLanguage();
50 if ("zh".equals(lang) && "CN".equals(locale.getCountry()))
51 lang = "zh_cn";
52 try (InputStream is = context.getAssets().open("bip39/" + lang + ".txt")) {
53 return getWord(is, index);
54 } catch (Throwable ex) {
55 Log.w(ex);
56 try (InputStream is = context.getAssets().open("bip39/en.txt")) {
57 return getWord(is, index);
58 } catch (Throwable exex) {
59 Log.e(exex);
60 return getRandomWord(5);
61 }
62 }
63 }
64
65 private static String getWord(InputStream is, int index) throws IOException {
66 String word = null;

Callers 1

getMnemonicMethod · 0.95

Calls 7

wMethod · 0.95
eMethod · 0.95
getRandomWordMethod · 0.95
getLanguageMethod · 0.80
equalsMethod · 0.45
openMethod · 0.45
readLineMethod · 0.45

Tested by

no test coverage detected