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 object
    static class  YAMLPropertyReader.Property
    Returned property
  • Field Summary

    Fields inherited from class java.io.FilterReader

    in

    Fields inherited from class java.io.Reader

    lock
  • Constructor Summary

    Constructors 
    Constructor Description
    YAMLPropertyReader​(java.io.Reader _reader)
    Default constructor with appendListLength set true
    YAMLPropertyReader​(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

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      protected java.util.Optional<YAMLPropertyReader.Entry> readLine() throws java.text.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:
      java.text.ParseException - if cannot parse the provided _line
    • stream

      public java.util.stream.Stream<YAMLPropertyReader.Property> stream()
      Stream properties populating them ordered
      Returns:
      Stream of Properties
    • close

      public void close()
      Specified by:
      close in interface java.lang.AutoCloseable
      Specified by:
      close in interface java.io.Closeable
      Overrides:
      close in class java.io.FilterReader