Package org.snakeyaml.engine.v2.api
Class Load
java.lang.Object
org.snakeyaml.engine.v2.api.Load
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLoad
(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
Modifier and TypeMethodDescriptionprotected Composer
createComposer
(InputStream yamlStream) Create Composerprotected Composer
createComposer
(Reader yamlReader) Create Composerprotected Composer
createComposer
(String yaml) Create Composerprivate Composer
createComposer
(StreamReader streamReader) Create ComposerloadAllFromInputStream
(InputStream yamlStream) Parse all YAML documents in a stream and produce corresponding Java objects.loadAllFromReader
(Reader yamlReader) Parse all YAML documents in a String and produce corresponding Java objects.loadAllFromString
(String yaml) Parse all YAML documents in a String and produce corresponding Java objects.loadFromInputStream
(InputStream yamlStream) Parse the only YAML document in a stream and produce the corresponding Java object.loadFromReader
(Reader yamlReader) Parse a YAML document and create a Java instanceloadFromString
(String yaml) Parse a YAML document and create a Java instanceprotected Object
Load with provided Composer
-
Field Details
-
settings
-
constructor
-
-
Constructor Details
-
Load
Create instance to parse the incoming YAML data and create Java instances- Parameters:
settings
- - configuration
-
Load
Create instance to parse the incoming YAML data and create Java instances- Parameters:
settings
- - configurationconstructor
- - custom YAML constructor
-
-
Method Details
-
createComposer
Create Composer- Parameters:
streamReader
- - the input- Returns:
- configured Composer
-
createComposer
Create Composer- Parameters:
yamlStream
- - the input- Returns:
- configured Composer
-
createComposer
Create Composer- Parameters:
yaml
- - the input- Returns:
- configured Composer
-
createComposer
Create Composer- Parameters:
yamlReader
- - the input- Returns:
- configured Composer
-
loadOne
Load with provided Composer- Parameters:
composer
- - the component to create the Node- Returns:
- deserialised YAML document
-
loadFromInputStream
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
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
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
-
loadAllFromInputStream
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
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
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
-