Class Load

java.lang.Object
org.snakeyaml.engine.v2.api.Load

public class Load extends Object
Common way to load Java instance(s). This class is not thread-safe. Which means that all the methods of the same instance can be called only by one thread. It is better to create an instance for every YAML stream. The instance is stateful. Only one of the 'load' methods may be called, and it may be called only once.
  • Field Details

  • Constructor Details

    • Load

      public Load(LoadSettings settings)
      Create instance to parse the incoming YAML data and create Java instances
      Parameters:
      settings - - configuration
    • Load

      public Load(LoadSettings settings, BaseConstructor constructor)
      Create instance to parse the incoming YAML data and create Java instances
      Parameters:
      settings - - configuration
      constructor - - custom YAML constructor
  • Method Details

    • createComposer

      private Composer createComposer(StreamReader streamReader)
      Create Composer
      Parameters:
      streamReader - - the input
      Returns:
      configured Composer
    • createComposer

      protected Composer createComposer(InputStream yamlStream)
      Create Composer
      Parameters:
      yamlStream - - the input
      Returns:
      configured Composer
    • createComposer

      protected Composer createComposer(String yaml)
      Create Composer
      Parameters:
      yaml - - the input
      Returns:
      configured Composer
    • createComposer

      protected Composer createComposer(Reader yamlReader)
      Create Composer
      Parameters:
      yamlReader - - the input
      Returns:
      configured Composer
    • loadOne

      protected Object loadOne(Composer composer)
      Load with provided Composer
      Parameters:
      composer - - the component to create the Node
      Returns:
      deserialised YAML document
    • loadFromInputStream

      public Object loadFromInputStream(InputStream yamlStream)
      Parse the only YAML document in a stream and produce the corresponding Java object.
      Parameters:
      yamlStream - - data to load from (BOM is respected to detect encoding and removed from the data)
      Returns:
      parsed Java instance
    • loadFromReader

      public Object loadFromReader(Reader yamlReader)
      Parse a YAML document and create a Java instance
      Parameters:
      yamlReader - - data to load from (BOM must not be present)
      Returns:
      parsed Java instance
    • loadFromString

      public Object loadFromString(String yaml)
      Parse a YAML document and create a Java instance
      Parameters:
      yaml - - YAML data to load from (BOM must not be present)
      Returns:
      parsed Java instance
      Throws:
      YamlEngineException - if the YAML is not valid
    • loadAll

      private Iterable<Object> loadAll(Composer composer)
    • loadAllFromInputStream

      public Iterable<Object> loadAllFromInputStream(InputStream yamlStream)
      Parse all YAML documents in a stream and produce corresponding Java objects. The documents are parsed only when the iterator is invoked.
      Parameters:
      yamlStream - - YAML data to load from (BOM is respected to detect encoding and removed from the data)
      Returns:
      an Iterable over the parsed Java objects in this stream in proper sequence
    • loadAllFromReader

      public Iterable<Object> loadAllFromReader(Reader yamlReader)
      Parse all YAML documents in a String and produce corresponding Java objects. The documents are parsed only when the iterator is invoked.
      Parameters:
      yamlReader - - YAML data to load from (BOM must not be present)
      Returns:
      an Iterable over the parsed Java objects in this stream in proper sequence
    • loadAllFromString

      public Iterable<Object> loadAllFromString(String yaml)
      Parse all YAML documents in a String and produce corresponding Java objects. (Because the encoding in known BOM is not respected.) The documents are parsed only when the iterator is invoked.
      Parameters:
      yaml - - YAML data to load from (BOM must not be present)
      Returns:
      an Iterable over the parsed Java objects in this stream in proper sequence