public class TomlWriter extends Object
日期格式支持:
LocalDate
LocalDateTime
ZonedDateTime
此类支持更加宽松的key,除了A-Za-z0-9_-
,其他key使用"包装。
Constructor and Description |
---|
TomlWriter(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.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying writer, flushing it first.
|
void |
flush()
Flushes the underlying writer.
|
void |
write(Map<String,Object> data)
Writes the specified data in the TOML format.
|
public TomlWriter(Writer writer)
TomlWriter(writer, 1, false, System.lineSeparator()
.writer
- where to write the datapublic TomlWriter(Writer writer, int indentSize, boolean indentWithSpaces)
TomlWriter(writer, indentSize, indentWithSpaces, System.lineSeparator())
.writer
- where to write the dataindentSize
- the size of each indentindentWithSpaces
- true to indent with spaces, false to indent with tabspublic TomlWriter(Writer writer, int indentSize, boolean indentWithSpaces, String lineSeparator)
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 linespublic void close() throws IOException
IOException
- if an error occurspublic void flush() throws IOException
IOException
- if an error occurspublic void write(Map<String,Object> data) throws IORuntimeException
data
- the data to writeIORuntimeException
- if an error occursCopyright © 2025. All rights reserved.