Package: groovy.toml

## [Java] Class TomlSlurper

- groovy.toml.TomlSlurper

-     @Incubating
      public class TomlSlurper
      extends Object

  Represents a TOML parser

  Since:
    4.0.0

- - ### Constructor Summary

    Constructors
    Constructor and description
    `TomlSlurper()` Creates a TOML parser that produces standard Groovy data structures.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public Object` | `parse(Reader reader)` Parse the content of the specified reader into a tree of Nodes.
    `` | `public Object` | `parse(InputStream stream)` Parse the content of the specified reader into a tree of Nodes.
    `` | `public Object` | `parse(File file)` Parse the content of the specified file into a tree of Nodes.
    `` | `public Object` | `parse(Path path)` Parse the content of the specified path into a tree of Nodes.
    `<T>` | `public T` | `parseAs(Class<T> type, Reader reader)` Parse TOML from a reader into a typed object.
    `<T>` | `public T` | `parseAs(Class<T> type, InputStream stream)` Parse TOML from an input stream into a typed object.
    `<T>` | `public T` | `parseAs(Class<T> type, File file)` Parse TOML from a file into a typed object.
    `<T>` | `public T` | `parseAs(Class<T> type, Path path)` Parse TOML from a path into a typed object.
    `` | `public Object` | `parseText(String toml)` Parse the content of the specified toml into a tree of Nodes.
    `<T>` | `public T` | `parseTextAs(Class<T> type, String toml)` Parse the content of the specified TOML text into a typed object using Jackson databinding.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### public TomlSlurper()

      Creates a TOML parser that produces standard Groovy data structures.

  - ### Method Detail

    - #### public Object parse(Reader reader)

      Parse the content of the specified reader into a tree of Nodes.

      Parameters:
        `reader` - the reader of toml
      Returns:
        the root node of the parsed tree of Nodes

    - #### public Object parse(InputStream stream)

      Parse the content of the specified reader into a tree of Nodes.

      Parameters:
        `stream` - the reader of toml
      Returns:
        the root node of the parsed tree of Nodes

    - #### public Object parse(File file)

      Parse the content of the specified file into a tree of Nodes.

      Parameters:
        `file` - the reader of toml
      Returns:
        the root node of the parsed tree of Nodes

    - #### public Object parse(Path path)

      Parse the content of the specified path into a tree of Nodes.

      Parameters:
        `path` - the reader of toml
      Returns:
        the root node of the parsed tree of Nodes

    - #### <T> public T parseAs(Class<T> type, Reader reader)

      Parse TOML from a reader into a typed object.

      Parameters:
        `type` - the target type
        `reader` - the reader of TOML
      Type Parameters:
        `T` - the target type
      Returns:
        a typed object
      Since:
        6.0.0

    - #### <T> public T parseAs(Class<T> type, InputStream stream)

      Parse TOML from an input stream into a typed object.

      Parameters:
        `type` - the target type
        `stream` - the input stream of TOML
      Type Parameters:
        `T` - the target type
      Returns:
        a typed object
      Since:
        6.0.0

    - #### <T> public T parseAs(Class<T> type, File file)

      Parse TOML from a file into a typed object.

      Parameters:
        `type` - the target type
        `file` - the TOML file
      Type Parameters:
        `T` - the target type
      Returns:
        a typed object
      Since:
        6.0.0

    - #### <T> public T parseAs(Class<T> type, Path path)

      Parse TOML from a path into a typed object.

      Parameters:
        `type` - the target type
        `path` - the path to the TOML file
      Type Parameters:
        `T` - the target type
      Returns:
        a typed object
      Since:
        6.0.0

    - #### public Object parseText(String toml)

      Parse the content of the specified toml into a tree of Nodes.

      Parameters:
        `toml` - the content of toml
      Returns:
        the root node of the parsed tree of Nodes

    - #### <T> public T parseTextAs(Class<T> type, String toml)

      Parse the content of the specified TOML text into a typed object using Jackson databinding. Supports `@JsonProperty` and `@JsonFormat` annotations for property mapping and type conversion.

      Parameters:
        `type` - the target type
        `toml` - the content of TOML
      Type Parameters:
        `T` - the target type
      Returns:
        a typed object
      Since:
        6.0.0