IOSStringsResource extends ResourceFilter { @Override public void write(OutputStream outStream, LanguageBundle languageBundle, FilterOptions options) throws IOException, ResourceFilterException { BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outStream, CHAR_SET)); boolean globalNotesWritten = false; for (String globalNote : languageBundle.getNotes()) { writer.write(COMMENT_BEGIN+globalNote+COMMENT_END); writer.newLine(); globalNotesWritten = true; } if (globalNotesWritten) { writer.newLine(); } BreakIterator brkItr = Utils.getWordBreakIterator(options); for (ResourceString res : languageBundle.getSortedResourceStrings()) { writer.write(formatEntry(res.getKey(), res.getValue(), res.getNotes(), brkItr)); } writer.flush(); }  @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 testWrite() throws IOException, ResourceFilterException { File tempFile = File.createTempFile(this.getClass().getSimpleName(), ".strings"); tempFile.deleteOnExit(); try (OutputStream os = new FileOutputStream(tempFile)) { res.write(os, WRITE_BUNDLE, null); os.flush(); assertTrue(ResourceTestUtil.compareFiles(EXPECTED_WRITE_FILE, tempFile)); } }