class CSVFilter extends ResourceFilter {

    @Override
    public void write(OutputStream outStream, LanguageBundle languageBundle, FilterOptions options)
            throws IOException, ResourceFilterException {
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outStream, StandardCharsets.UTF_8));
        CSVPrinter printer = CSVFormat.RFC4180.withHeader("key", "value").print(writer);
        for (ResourceString resString : languageBundle.getSortedResourceStrings()) {
            printer.printRecord(resString.getKey(), resString.getValue());
        }
        printer.flush();
    }

}