Package org.snakeyaml.engine.v2.api
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.
-
-
Constructor Summary
Constructors Constructor Description Load(LoadSettings settings)
Create instance to parse the incoming YAML data and create Java instancesLoad(LoadSettings settings, BaseConstructor constructor)
Create instance to parse the incoming YAML data and create Java instances
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Composer
createComposer(InputStream yamlStream)
protected Composer
createComposer(Reader yamlReader)
protected Composer
createComposer(String yaml)
Iterable<Object>
loadAllFromInputStream(InputStream yamlStream)
Parse all YAML documents in a stream and produce corresponding Java objects.Iterable<Object>
loadAllFromReader(Reader yamlReader)
Parse all YAML documents in a String and produce corresponding Java objects.Iterable<Object>
loadAllFromString(String yaml)
Parse all YAML documents in a String and produce corresponding Java objects.Object
loadFromInputStream(InputStream yamlStream)
Parse the only YAML document in a stream and produce the corresponding Java object.Object
loadFromReader(Reader yamlReader)
Parse a YAML document and create a Java instanceObject
loadFromString(String yaml)
Parse a YAML document and create a Java instanceprotected Object
loadOne(Composer composer)
-
-
-
Constructor Detail
-
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
- - configurationconstructor
- - custom YAML constructor
-
-
Method Detail
-
createComposer
protected Composer createComposer(InputStream yamlStream)
-
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
-
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
-
-