public static String readInput(InputStream is) throws HyscaleException {
        if (is == null) {
            is = DEFAULT_INPUT_STREAM;
        }
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(is));
            return br.readLine();
        } catch (Exception e) {
            logger.error("Error while getting valid input", e);
            throw new HyscaleException(e, CommonErrorCode.FAILED_TO_GET_VALID_INPUT);
        }
    }
Class to read user provided input
@author tushar
commons/src/main/java/io/hyscale/commons/io/HyscaleInputReader.java