Class TomlWriter
java.lang.Object
org.miaixz.bus.setting.metric.toml.TomlWriter
TOML生成器
日期格式支持:
- 2015-03-20 转为:
LocalDate - 2015-03-20T19:04:35 转为:
LocalDateTime - 2015-03-20T19:04:35+01:00 转为:
ZonedDateTime
此类支持更加宽松的key,除了A-Za-z0-9_- ,其他key使用"包装。
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
ConstructorsConstructorDescriptionTomlWriter(Writer writer) Creates a new TomlWriter with the defaults parameters.TomlWriter(Writer writer, int indentSize, boolean indentWithSpaces) Creates a new TomlWriter with the specified parameters.TomlWriter(Writer writer, int indentSize, boolean indentWithSpaces, String lineSeparator) Creates a new TomlWriter with the specified parameters. -
Method Summary
-
Constructor Details
-
TomlWriter
Creates a new TomlWriter with the defaults parameters. The system line separator is used (ie '\n' on Linux and OSX, "\r\n" on Windows). This is exactly the same asTomlWriter(writer, 1, false, System.lineSeparator().- Parameters:
writer- where to write the data
-
TomlWriter
Creates a new TomlWriter with the specified parameters. The system line separator is used (ie '\n' on Linux and OSX, "\r\n" on Windows). This is exactly the same asTomlWriter(writer, indentSize, indentWithSpaces, System.lineSeparator()).- Parameters:
writer- where to write the dataindentSize- the size of each indentindentWithSpaces- true to indent with spaces, false to indent with tabs
-
TomlWriter
Creates a new TomlWriter with the specified parameters.- Parameters:
writer- where to write the dataindentSize- the size of each indentindentWithSpaces- true to indent with spaces, false to indent with tabslineSeparator- the String to write to break lines
-
-
Method Details
-
close
Closes the underlying writer, flushing it first.- Throws:
IOException- if an error occurs
-
flush
Flushes the underlying writer.- Throws:
IOException- if an error occurs
-
write
public void write(Map<String, Object> data) throws org.miaixz.bus.core.lang.exception.InternalExceptionWrites the specified data in the TOML format.- Parameters:
data- the data to write- Throws:
org.miaixz.bus.core.lang.exception.InternalException- if an error occurs
-