AmdJsResource extends ResourceFilter { @Override public LanguageBundle parse(InputStream inStream, FilterOptions options) throws IOException, ResourceFilterException { LanguageBundleBuilder bb = new LanguageBundleBuilder(true); try (InputStreamReader reader = new InputStreamReader(new BomInputStream(inStream), "UTF-8")) { AstRoot root = new Parser().parse(reader, null, 1); KeyValueVisitor visitor = new KeyValueVisitor(); root.visitAll(visitor); LinkedHashMap<String, ValueData> resultMap = visitor.elements; for (Entry<String, ValueData> entry : resultMap.entrySet()) { bb.addResourceString(entry.getKey(), entry.getValue().getValue()); } } return bb.build(); }  @Override LanguageBundle parse(InputStream inStream, FilterOptions options); @Override void write(OutputStream outStream, LanguageBundle languageBundle,
            FilterOptions options); @Override void merge(InputStream baseStream, OutputStream outStream, LanguageBundle languageBundle,
            FilterOptions options);  }
@Test public void testParse() throws IOException, ResourceFilterException { assertTrue("The input test file <" + INPUT_FILE + "> does not exist.", INPUT_FILE.exists()); try (InputStream is = new FileInputStream(INPUT_FILE)) { LanguageBundle bundle = res.parse(is, null); List<ResourceString> resStrList = new ArrayList<>(bundle.getResourceStrings()); Collections.sort(resStrList, new ResourceStringComparator()); assertEquals("ResourceStrings did not match.", EXPECTED_INPUT_RES_LIST, resStrList); } }