Module bus.setting

Class TomlReader

java.lang.Object
org.miaixz.bus.setting.metric.toml.TomlReader

public class TomlReader extends Object
A reader for TOML (Tom's Obvious, Minimal Language) files. This implementation is based on the TOML-javalib project.

Supported date formats:

This class supports a lenient bare key syntax in addition to the standard A-Za-z0-9_- characters.

Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • TomlReader

      public TomlReader(String data, boolean strictAsciiBareKeys)
      Constructs a new TomlReader.

      Bare key character rules:

       Strict mode (true): [A-Za-z0-9_-]
       Lenient mode (false): Any character except . [ ] # =
       
      Parameters:
      data - The TOML data as a string.
      strictAsciiBareKeys - If true, only allows strict bare key format; if false, supports a more lenient format.
  • Method Details

    • read

      public Map<String,Object> read()
      Reads and parses the entire TOML data string into a map.
      Returns:
      A map representing the parsed TOML data.