All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fitbur.mockito.internal.configuration.plugins.PluginFileReader Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package com.fitbur.mockito.internal.configuration.plugins;

import com.fitbur.mockito.internal.util.io.IOUtil;

import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;

class PluginFileReader {

    String readPluginClass(InputStream input) throws IOException {
        for(String line: IOUtil.readLines(input)) {
            String stripped = stripCommentAndWhitespace(line);
            if (stripped.length() > 0) {
                return stripped;
            }
        }
        return null;
    }

    private static String stripCommentAndWhitespace(String line) {
        int hash = line.indexOf('#');
        if (hash != -1) {
            line = line.substring(0, hash);
        }
        return line.trim();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy