public void parseStream(JsonConfigCollection result, InputStream input, String location) { try (InputStreamReader contentReader = new InputStreamReader(input)) { if (input.available() < 1) { result.addError("File is empty", location); return; } YamlConfig config = new YamlConfig(); config.setAllowDuplicates(false); YamlReader reader = new YamlReader(contentReader, config); Object rootObject = reader.read(); JsonConfigCollection filePart = rootTransform.transform(rootObject, location); result.append(filePart); } catch (YamlReader.YamlReaderException e) { result.addError(e.getMessage(), location); } catch (IOException e) { result.addError(e.getMessage() + " : " + e.getCause().getMessage() + " : ", location); } } }