Package org.bytemechanics.commons.io
Class YAMLPropertyReader
- java.lang.Object
-
- java.io.Reader
-
- java.io.FilterReader
-
- org.bytemechanics.commons.io.YAMLPropertyReader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
public class YAMLPropertyReader extends 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
-
Fields inherited from class java.io.FilterReader
in
-
-
Constructor Summary
Constructors Constructor Description YAMLPropertyReader(Reader _reader)
Default constructor with appendListLength set trueYAMLPropertyReader(Reader _reader, boolean _appendListLength)
Constructor capable to define appendListLength value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected Optional<YAMLPropertyReader.Entry>
readLine()
Read and parse next available line with actual content (ignoring commnets) and parses to Entry.Stream<YAMLPropertyReader.Property>
stream()
Stream properties populating them ordered-
Methods inherited from class java.io.FilterReader
mark, markSupported, read, read, ready, reset, skip
-
Methods inherited from class java.io.Reader
nullReader, read, read, transferTo
-
-
-
-
Constructor Detail
-
YAMLPropertyReader
public YAMLPropertyReader(Reader _reader)
Default constructor with appendListLength set true- Parameters:
_reader
- parent reader
-
YAMLPropertyReader
public YAMLPropertyReader(Reader _reader, boolean _appendListLength)
Constructor capable to define appendListLength value- Parameters:
_reader
- parent reader_appendListLength
- append list length as an additional property
-
-
Method Detail
-
readLine
protected Optional<YAMLPropertyReader.Entry> readLine() throws ParseException
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:
ParseException
- if cannot parse the provided _line
-
stream
public Stream<YAMLPropertyReader.Property> stream()
Stream properties populating them ordered- Returns:
- Stream of Properties
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterReader
-
-