@Test public void readTheList() throws IOException { InputStream resource = EhTagDatabaseTest.class.getResourceAsStream("EhTagDatabaseTest"); EhTagDatabase db; try (BufferedSource source = Okio.buffer(Okio.source(resource))) { db = new EhTagDatabase("EhTagDatabaseTest", source); } assertEquals("a", db.getTranslation("1")); assertEquals("ab", db.getTranslation("12")); assertEquals("abc", db.getTranslation("123")); assertEquals("abcd", db.getTranslation("1234")); assertEquals("1", db.getTranslation("a")); assertEquals("12", db.getTranslation("ab")); assertEquals("123", db.getTranslation("abc")); assertEquals("1234", db.getTranslation("abcd")); assertNull(db.getTranslation("21")); }
public String getTranslation(String tag) { return search(tags, tag.getBytes(TextUrl.UTF_8)); }
EhTagDatabase { public String getTranslation(String tag) { return search(tags, tag.getBytes(TextUrl.UTF_8)); } }
EhTagDatabase { public String getTranslation(String tag) { return search(tags, tag.getBytes(TextUrl.UTF_8)); } EhTagDatabase(String name, BufferedSource source); }
EhTagDatabase { public String getTranslation(String tag) { return search(tags, tag.getBytes(TextUrl.UTF_8)); } EhTagDatabase(String name, BufferedSource source); String getTranslation(String tag); @Nullable static EhTagDatabase getInstance(Context context); @Nullable static String namespaceToPrefix(String namespace); static boolean isPossible(Context context); static void update(Context context); }
EhTagDatabase { public String getTranslation(String tag) { return search(tags, tag.getBytes(TextUrl.UTF_8)); } EhTagDatabase(String name, BufferedSource source); String getTranslation(String tag); @Nullable static EhTagDatabase getInstance(Context context); @Nullable static String namespaceToPrefix(String namespace); static boolean isPossible(Context context); static void update(Context context);  }