public static Map readPropertiesFromStream()

in tc-sbt-runner-agent/src/main/java/jetbrains/buildServer/sbt/SbtVersionDetector.java [91:109]


    public static Map<String, String> readPropertiesFromStream(InputStream inputStream, @NotNull String sectionName) throws IOException {
        Map<String, String> properties = new HashMap<String, String>();
        List lines = IOUtils.readLines(inputStream);
        boolean take = false;
        for (Object line : lines) {
            String str = ((String) line).trim();
            if (str.startsWith("[")) {
                take = str.contains(sectionName + "]");
            } else if (take) {
                Matcher matcher = PROPERTY.matcher(str);
                boolean propertyLine = matcher.find();
                if (propertyLine) {
                    properties.put(matcher.group(1), matcher.group(2).trim());
                }

            }
        }
        return properties;
    }