Package java.io

Examples of java.io.Console.format()


        String propertyValue = props.getProperty(propertyName);
        if (StringUtil.isBlank(propertyValue)) {

            // prompt for the property value
            Console console = System.console();
            console.format("\nThe [%s] property is required but not set in [%s].\n", propertyName, propertiesFileName);
            console.format("Do you want to set [%s] value now?\n", propertyName);
            String response = "";
            while (!(response.startsWith("n") || response.startsWith("y"))) {
                response = String.valueOf(console.readLine("%s", "yes|no: ")).toLowerCase();
            }
View Full Code Here


        if (StringUtil.isBlank(propertyValue)) {

            // prompt for the property value
            Console console = System.console();
            console.format("\nThe [%s] property is required but not set in [%s].\n", propertyName, propertiesFileName);
            console.format("Do you want to set [%s] value now?\n", propertyName);
            String response = "";
            while (!(response.startsWith("n") || response.startsWith("y"))) {
                response = String.valueOf(console.readLine("%s", "yes|no: ")).toLowerCase();
            }
            if (response.startsWith("n")) {
View Full Code Here

                            + (((obfuscate || encode) ? " (enter as plain text): " : ": "))));
                    }
                }

                if (!hideInput) {
                    console.format("Is [" + propertyValue + "] correct?\n");
                    response = "";
                    while (!(response.startsWith("n") || response.startsWith("y"))) {
                        response = String.valueOf(console.readLine("%s", "yes|no: ")).toLowerCase();
                    }
                } else {
View Full Code Here

                    response = "";
                    while (!(response.startsWith("n") || response.startsWith("y"))) {
                        response = String.valueOf(console.readLine("%s", "yes|no: ")).toLowerCase();
                    }
                } else {
                    console.format("Confirm:\n");
                    String confirmValue = String.valueOf(console.readPassword("%s", propertyName
                        + (((obfuscate || encode) ? " (enter as plain text): " : ": "))));
                    if (propertyValue.equals(confirmValue)) {
                        response = "yes";
                    } else {
View Full Code Here

    do {
        char [] newPassword1 = c.readPassword("Enter master secret: ");
        char [] newPassword2 = c.readPassword("Enter master secret again: ");
        noMatch = ! Arrays.equals(newPassword1, newPassword2);
        if (noMatch) {
            c.format("Passwords don't match. Try again.%n");
        } else {
            this.master = Arrays.copyOf(newPassword1, newPassword1.length);
        }
        Arrays.fill(newPassword1, ' ');
        Arrays.fill(newPassword2, ' ');
View Full Code Here

    do {
        char [] newPassword1 = c.readPassword("Enter master secret: ");
        char [] newPassword2 = c.readPassword("Enter master secret again: ");
        noMatch = ! Arrays.equals(newPassword1, newPassword2);
        if (noMatch) {
            c.format("Passwords don't match. Try again.%n");
        } else {
            this.master = Arrays.copyOf(newPassword1, newPassword1.length);
        }
        Arrays.fill(newPassword1, ' ');
        Arrays.fill(newPassword2, ' ');
View Full Code Here

    do {
        char [] newPassword1 = c.readPassword("Enter master secret: ");
        char [] newPassword2 = c.readPassword("Enter master secret again: ");
        noMatch = ! Arrays.equals(newPassword1, newPassword2);
        if (noMatch) {
            c.format("Passwords don't match. Try again.%n");
        } else {
            this.master = Arrays.copyOf(newPassword1, newPassword1.length);
        }
        Arrays.fill(newPassword1, ' ');
        Arrays.fill(newPassword2, ' ');
View Full Code Here

            Matcher matcher =
            pattern.matcher(console.readLine("Enter input string to search: "));

            boolean found = false;
            while (matcher.find()) {
                console.format("I found the text \"%s\" starting at " +
                   "index %d and ending at index %d.%n",
                    matcher.group(), matcher.start(), matcher.end());
                found = true;
            }
            if(!found){
View Full Code Here

                   "index %d and ending at index %d.%n",
                    matcher.group(), matcher.start(), matcher.end());
                found = true;
            }
            if(!found){
                console.format("No match found.%n");
            }
        }
    }
}
View Full Code Here

            Matcher matcher =
            pattern.matcher(console.readLine("Enter input string to search: "));
            boolean found = false;
            while (matcher.find()) {
                console.format("I found the text" +
                    " \"%s\" starting at " +
                    "index %d and ending at index %d.%n",
                    matcher.group(),
                    matcher.start(),
                    matcher.end());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.