title: Error in reading yaml file using `snakeyaml`
body: <p>I am getting <code>Exception in thread "main" org.yaml.snakeyaml.error.YAMLException: java.io.IOException: Stream closed</code> when reading yaml file in my code:</p>
  
  <p>Below is my project structure:</p>
  
  <pre><code>-rc
   - main
     - java
       - MyMainClass
     - resources
       - application.yaml
  </code></pre>
  
  <p>Here is the sample code:</p>
  
  <pre><code>public class LoadYaml {
  
      private static final Logger LOGGER = LoggerFactory.getLogger(LoadYaml.class);
  
      public void loadYaml() {
  
          Yaml yaml = new Yaml(new Constructor(Config.class));
          InputStream inputStream = this.getClass()
                  .getClassLoader()
                  .getResourceAsStream("resources/application.yaml");
          Config config = yaml.load(inputStream);
  
          LOGGER.info(config.toString());
      }
  </code></pre>
  
  <p>Below is my custom class for yaml:</p>
  
  <pre><code>package org.finra.dapi.parttioncleanup;
  
  import java.util.List;
  
  public class Config {
  
      private String url;
      private String userName;
      private String pwsKey;
      private List&lt;Tables&gt; tables;
  
     ....getters and setters
  
  </code></pre>
  
  <p>Error stack:</p>
  
  <pre><code>Exception in thread "main" org.yaml.snakeyaml.error.YAMLException: java.io.IOException: Stream closed
      at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:218)
      at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.java:176)
      at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.java:171)
      at org.yaml.snakeyaml.reader.StreamReader.peek(StreamReader.java:126)
      at org.yaml.snakeyaml.scanner.ScannerImpl.scanToNextToken(ScannerImpl.java:1177)
      at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:287)
      at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:227)
      at org.yaml.snakeyaml.parser.ParserImpl$ParseImplicitDocumentStart.produce(ParserImpl.java:195)
      at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
      at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148)
      at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:107)
      at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:139)
      at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:524)
      at org.yaml.snakeyaml.Yaml.load(Yaml.java:452)
      at org.finra.dapi.parttioncleanup.LoadYaml.loadYaml(LoadYaml.java:23)
      at org.finra.dapi.parttioncleanup.LambdaHandler.main(LambdaHandler.java:25)
  Caused by: java.io.IOException: Stream closed
      at java.io.PushbackInputStream.ensureOpen(PushbackInputStream.java:74)
      at java.io.PushbackInputStream.read(PushbackInputStream.java:166)
      at org.yaml.snakeyaml.reader.UnicodeReader.init(UnicodeReader.java:92)
      at org.yaml.snakeyaml.reader.UnicodeReader.read(UnicodeReader.java:124)
      at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:183)
      ... 15 more
  </code></pre>
  
  <p>Any help would be appreciated, thank you</p>