HoconWriter implements ConfigWriter { @Override public void write(UnmodifiableConfig config, Writer writer) { currentIndentLevel = -1; UnmodifiableCommentedConfig commentedConfig; if (config instanceof UnmodifiableCommentedConfig) { commentedConfig = (UnmodifiableCommentedConfig)config; } else { commentedConfig = new FakeUnmodifiableCommentedConfig(config); } writeObject(commentedConfig, new WriterOutput(writer), true); }  @Override void write(UnmodifiableConfig config, Writer writer); HoconWriter setIndentObjectElementsPredicate(
		Predicate<UnmodifiableConfig> indentObjectElementsPredicate); HoconWriter setIndentArrayElementsPredicate(
		Predicate<Collection<?>> indentArrayElementsPredicate); HoconWriter setNewlineAfterObjectStart(boolean newlineAfterObjectStart); HoconWriter setIndent(IndentStyle indentStyle); HoconWriter setIndent(String indentString); HoconWriter setNewline(NewlineStyle newlineStyle); HoconWriter setNewline(String newlineString); HoconWriter setKeyValueSeparator(KeyValueSeparatorStyle separatorStyle); HoconWriter setKeyValueSeparator(String separatorString); HoconWriter setCommentPrefix(CommentStyle commentPrefixStyle); HoconWriter setCommentPrefix(String commentPrefixString);  }
@Test public void testWrite() throws IOException { Config subConfig = CommentedConfig.inMemory(); subConfig.set("string", "test"); subConfig.set("enum", BasicTestEnum.C); subConfig.set("sub", CommentedConfig.inMemory()); List<Config> configList = new ArrayList<>(); configList.add(subConfig); configList.add(subConfig); configList.add(subConfig); CommentedConfig config = CommentedConfig.inMemory(); config.set("string", "\"value\""); config.set("integer", 2); config.set("long", 123456789L); config.set("double", 3.1415926535); config.set("bool_array", Arrays.asList(true, false, true, false)); config.set("config", subConfig); config.set("config_list", configList); config.setComment("string", " Comment 1\n Comment 2\n Comment 3"); config.set("enum", TestEnum.A); StringWriter sw = new StringWriter(); HoconWriter writer = new HoconWriter(); writer.write(config, sw); System.out.println("Written:"); System.out.println(sw); }