Class TomlParser

  • All Implemented Interfaces:
    com.electronwill.nightconfig.core.io.ConfigParser<com.electronwill.nightconfig.core.CommentedConfig>

    public final class TomlParser
    extends java.lang.Object
    implements com.electronwill.nightconfig.core.io.ConfigParser<com.electronwill.nightconfig.core.CommentedConfig>
    A configurable parser of TOML configurations. It is not thread-safe.
    See Also:
    TOML specification
    • Constructor Summary

      Constructors 
      Constructor Description
      TomlParser()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.electronwill.nightconfig.core.ConfigFormat<com.electronwill.nightconfig.core.CommentedConfig> getFormat()  
      boolean isLenientWithBareKeys()  
      boolean isLenientWithSeparators()  
      com.electronwill.nightconfig.core.CommentedConfig parse​(java.io.Reader reader)  
      void parse​(java.io.Reader reader, com.electronwill.nightconfig.core.Config destination, com.electronwill.nightconfig.core.io.ParsingMode parsingMode)  
      TomlParser setInitialListCapacity​(int initialListCapacity)  
      TomlParser setInitialStringBuilderCapacity​(int initialStringBuilderCapacity)  
      TomlParser setLenientWithBareKeys​(boolean lenientBareKeys)
      Makes this parser lenient (if true) or strict (if false - this is the default) with bar keys.
      TomlParser setLenientWithSeparators​(boolean lenientSeparators)
      Makes this parser lenient (if true) or strict (if false - this is the default) with key/values separators.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.electronwill.nightconfig.core.io.ConfigParser

        parse, parse, parse, parse, parse, parse, parse, parse, parse, parse, parse, parse, parse, parse, parse, parse
    • Constructor Detail

      • TomlParser

        public TomlParser()
    • Method Detail

      • parse

        public com.electronwill.nightconfig.core.CommentedConfig parse​(java.io.Reader reader)
        Specified by:
        parse in interface com.electronwill.nightconfig.core.io.ConfigParser<com.electronwill.nightconfig.core.CommentedConfig>
      • parse

        public void parse​(java.io.Reader reader,
                          com.electronwill.nightconfig.core.Config destination,
                          com.electronwill.nightconfig.core.io.ParsingMode parsingMode)
        Specified by:
        parse in interface com.electronwill.nightconfig.core.io.ConfigParser<com.electronwill.nightconfig.core.CommentedConfig>
      • isLenientWithSeparators

        public boolean isLenientWithSeparators()
      • setLenientWithSeparators

        public TomlParser setLenientWithSeparators​(boolean lenientSeparators)
        Makes this parser lenient (if true) or strict (if false - this is the default) with key/values separators. In lenient mode, the parser accepts both '=' and ':' between keys and values. In strict mode, only the standard '=' is accepted.
        Parameters:
        lenientSeparators - true for lenient, false for strict
        Returns:
        this parser
      • isLenientWithBareKeys

        public boolean isLenientWithBareKeys()
      • setLenientWithBareKeys

        public TomlParser setLenientWithBareKeys​(boolean lenientBareKeys)
        Makes this parser lenient (if true) or strict (if false - this is the default) with bar keys. In lenient mode, almost all characters are allowed in bare keys. In struct mode, only the standard A-Za-z0-9_- range is allowed.
        Parameters:
        lenientBareKeys - true for lenient, false for strict
        Returns:
        this parser
      • setInitialStringBuilderCapacity

        public TomlParser setInitialStringBuilderCapacity​(int initialStringBuilderCapacity)
      • setInitialListCapacity

        public TomlParser setInitialListCapacity​(int initialListCapacity)
      • getFormat

        public com.electronwill.nightconfig.core.ConfigFormat<com.electronwill.nightconfig.core.CommentedConfig> getFormat()
        Specified by:
        getFormat in interface com.electronwill.nightconfig.core.io.ConfigParser<com.electronwill.nightconfig.core.CommentedConfig>