Class YAMLPropertyReader
java.lang.Object
java.io.Reader
java.io.FilterReader
org.bytemechanics.config.manager.internal.commons.io.YAMLPropertyReader
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Readable
public class YAMLPropertyReader
extends java.io.FilterReader
Simple yaml parser to convert to key-value pairs
Important notes:
- Multi-document yaml not supported (please avoid the triple-hyphens syntax)
- Author:
- afarre
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
YAMLPropertyReader.Entry
Internal single line entry readed objectstatic class
YAMLPropertyReader.Property
Returned property -
Field Summary
-
Constructor Summary
Constructors Constructor Description YAMLPropertyReader(java.io.Reader _reader)
Default constructor with appendListLength set trueYAMLPropertyReader(java.io.Reader _reader, boolean _appendListLength)
Constructor capable to define appendListLength value -
Method Summary
Modifier and Type Method Description void
close()
protected java.util.Optional<YAMLPropertyReader.Entry>
readLine()
Read and parse next available line with actual content (ignoring commnets) and parses to Entry.java.util.stream.Stream<YAMLPropertyReader.Property>
stream()
Stream properties populating them ordered
-
Constructor Details
-
YAMLPropertyReader
public YAMLPropertyReader(java.io.Reader _reader)Default constructor with appendListLength set true- Parameters:
_reader
- parent reader
-
YAMLPropertyReader
public YAMLPropertyReader(java.io.Reader _reader, boolean _appendListLength)Constructor capable to define appendListLength value- Parameters:
_reader
- parent reader_appendListLength
- append list length as an additional property
-
-
Method Details
-
readLine
Read and parse next available line with actual content (ignoring commnets) and parses to Entry.- Returns:
- Optional empty if there are no more lines to read or
- Throws:
java.text.ParseException
- if cannot parse the provided _line
-
stream
Stream properties populating them ordered- Returns:
- Stream of Properties
-
close
public void close()- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.FilterReader
-