@Test public void testReformat_multilineProperties() throws IOException { final Path propertiesRootDirectory= this.tmpFolder.getRoot().toPath(); final File f1= createI18nBundle(propertiesRootDirectory, "" + "\tkey\\ \\\n" + " one\\\n" + " : value \\\n" + " 1\n" + "key\\ \\\n" + " two\\\r" + " = \t value \\\r" + " 2\n" ); final FileMatcher fileMatcher= new FileMatcher(propertiesRootDirectory, new String[]{"**/*.properties"}, new String[]{""}); new KiltReformatter() .reformat(fileMatcher, "<key> = <value>\\n", false, UTF_8); assertThat(contentOf(f1)).isEqualTo("" + "key\\ \\\n" + " one\\\n" + " = value \\\n" + " 1\n" + "key\\ \\\n" + " two\\\r" + " = value \\\r" + " 2\n" ); }
public void reformat(final FileMatcher fileMatcher, final String formatString, final boolean reformatKeyAndValue, final Charset charset) { Require.nonNull(fileMatcher); Require.nonNull(formatString); Require.nonNull(charset); final Set<File> propertyFiles= fileMatcher.findMatchingFiles(); LOGGER.log(Level.INFO, "Reformatting entries in the following files: {}", propertyFiles); final Reformatter reformatter= new Reformatter( ReformatOptions.create() .with(charset) .withFormat(formatString) .withReformatKeyAndValue(reformatKeyAndValue)); for (final File propertyFile : propertyFiles) { reformatter.reformat(propertyFile); } }
KiltReformatter { public void reformat(final FileMatcher fileMatcher, final String formatString, final boolean reformatKeyAndValue, final Charset charset) { Require.nonNull(fileMatcher); Require.nonNull(formatString); Require.nonNull(charset); final Set<File> propertyFiles= fileMatcher.findMatchingFiles(); LOGGER.log(Level.INFO, "Reformatting entries in the following files: {}", propertyFiles); final Reformatter reformatter= new Reformatter( ReformatOptions.create() .with(charset) .withFormat(formatString) .withReformatKeyAndValue(reformatKeyAndValue)); for (final File propertyFile : propertyFiles) { reformatter.reformat(propertyFile); } } }
KiltReformatter { public void reformat(final FileMatcher fileMatcher, final String formatString, final boolean reformatKeyAndValue, final Charset charset) { Require.nonNull(fileMatcher); Require.nonNull(formatString); Require.nonNull(charset); final Set<File> propertyFiles= fileMatcher.findMatchingFiles(); LOGGER.log(Level.INFO, "Reformatting entries in the following files: {}", propertyFiles); final Reformatter reformatter= new Reformatter( ReformatOptions.create() .with(charset) .withFormat(formatString) .withReformatKeyAndValue(reformatKeyAndValue)); for (final File propertyFile : propertyFiles) { reformatter.reformat(propertyFile); } }  }
KiltReformatter { public void reformat(final FileMatcher fileMatcher, final String formatString, final boolean reformatKeyAndValue, final Charset charset) { Require.nonNull(fileMatcher); Require.nonNull(formatString); Require.nonNull(charset); final Set<File> propertyFiles= fileMatcher.findMatchingFiles(); LOGGER.log(Level.INFO, "Reformatting entries in the following files: {}", propertyFiles); final Reformatter reformatter= new Reformatter( ReformatOptions.create() .with(charset) .withFormat(formatString) .withReformatKeyAndValue(reformatKeyAndValue)); for (final File propertyFile : propertyFiles) { reformatter.reformat(propertyFile); } }  void reformat(final FileMatcher fileMatcher, final String formatString, final boolean reformatKeyAndValue, final Charset charset); void reorderByKey(final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset); void reorderByTemplate(final File template, final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset); }
KiltReformatter { public void reformat(final FileMatcher fileMatcher, final String formatString, final boolean reformatKeyAndValue, final Charset charset) { Require.nonNull(fileMatcher); Require.nonNull(formatString); Require.nonNull(charset); final Set<File> propertyFiles= fileMatcher.findMatchingFiles(); LOGGER.log(Level.INFO, "Reformatting entries in the following files: {}", propertyFiles); final Reformatter reformatter= new Reformatter( ReformatOptions.create() .with(charset) .withFormat(formatString) .withReformatKeyAndValue(reformatKeyAndValue)); for (final File propertyFile : propertyFiles) { reformatter.reformat(propertyFile); } }  void reformat(final FileMatcher fileMatcher, final String formatString, final boolean reformatKeyAndValue, final Charset charset); void reorderByKey(final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset); void reorderByTemplate(final File template, final FileMatcher fileMatcher, final AttachCommentsTo attachCommentsTo, final Charset charset);  }