mirror of
https://github.com/plexusorg/toml4j.git
synced 2024-12-29 11:42:15 +00:00
Use new 'write' vocabulary in the docs.
This commit is contained in:
parent
ec30be7901
commit
bcc52f5cb0
2 changed files with 6 additions and 13 deletions
|
@ -9,7 +9,7 @@
|
|||
|
||||
### Added
|
||||
|
||||
* Serialization of objects and Toml instances to TOML.
|
||||
* Support for writing objects to TOML format.
|
||||
* Support for underscores in numbers (the feature branch had accidentally not been merged! :( )
|
||||
* Set<Map.Entry> Toml#entrySet() cf. Reflection section in README
|
||||
* Overloaded getters that take a default value. Thanks to __[udiabon](https://github.com/udiabon)__.
|
||||
|
|
17
README.md
17
README.md
|
@ -233,18 +233,9 @@ toml.containsTable("a"); // false
|
|||
toml.containsTableArray("a"); // false
|
||||
```
|
||||
|
||||
### Serialization
|
||||
### Converting Objects To TOML
|
||||
|
||||
You can serialize a `Toml` or any arbitrary object to a TOML string.
|
||||
|
||||
Once you have populated a `Toml` via `Toml.parse()`, you can serialize it back to TOML.
|
||||
|
||||
```java
|
||||
Toml toml = new Toml().parse("a=1");
|
||||
String tomlString = toml.serialize();
|
||||
```
|
||||
|
||||
Or you can serialize any object.
|
||||
You can write any arbitrary object to a TOML `String`, `File`, `Writer`, or `OutputStream`.
|
||||
|
||||
```java
|
||||
class AClass {
|
||||
|
@ -252,7 +243,7 @@ class AClass {
|
|||
int[] anArray = { 2, 3 };
|
||||
}
|
||||
|
||||
String tomlString = Toml.serializeFrom(new AClass());
|
||||
String tomlString = new TomlWriter().write(new AClass());
|
||||
|
||||
/*
|
||||
yields:
|
||||
|
@ -261,6 +252,8 @@ anArray = [ 2, 3 ]
|
|||
*/
|
||||
```
|
||||
|
||||
See the `TomlWriter` class for more details.
|
||||
|
||||
### Limitations
|
||||
|
||||
Date precision is limited to milliseconds.
|
||||
|
|
Loading…
Reference in a new issue