public InteractiveTask(VJTop app) { this.app = app; tty = System.err; console = System.console(); }
private InitConsole() { this.console = System.console(); this.systemIn = null; this.systemOut = null; }
public String call() throws IOException { Console console = System.console(); if (console == null) return null; // no terminal char[] w = console.readPassword("Password:"); if (w==null) return null; return new String(w); }
private static String askForPasswd(String filePath){ Console cons = System.console(); String passwd = null; if (cons != null){ char[] p = cons.readPassword("%s", "Enter passphrase for " + filePath + ":"); passwd = String.valueOf(p); } return passwd; }
@Override public char[] promptPassword( String fmt, Object... args ) { return System.console().readPassword( fmt, args ); }
@Override public String readLine() { return System.console().readLine(); }
@Override public String promptLine( String fmt, Object... args ) { return System.console().readLine( fmt, args ); }
System.out.print("Enter something:"); String input = System.console().readLine();
import java.io.Console; Console console = System.console(); String s = console.readLine(); int i = Integer.parseInt(console.readLine());
/** Constructor. */ private GridConsoleAdapter(Console delegate) { this.delegate = System.console(); if (delegate == null) throw new NullPointerException("Console is not available."); }
public char[] readPassword(String prompt) { Console console = System.console(); char[] pass = console.readPassword(prompt); return pass; }
private String getPassword() { checkState(clientOptions.user != null, "Username must be specified along with password"); String defaultPassword = System.getenv("PRESTO_PASSWORD"); if (defaultPassword != null) { return defaultPassword; } java.io.Console console = System.console(); if (console == null) { throw new RuntimeException("No console from which to read password"); } char[] password = console.readPassword("Password: "); if (password != null) { return new String(password); } return ""; }
private static String promptForPassword(String passwordName, String commandLineOption, String envVarName) throws Exception { final Console console = System.console(); if(console == null) { throw new Exception("Cannot allocate a console. Set env var "+envVarName+" or "+commandLineOption+" on commandline in that case"); } return new String(console.readPassword("[%s]", passwordName+" password:")); }
private static String getPasswordFromConsole() { System.out.print("Please enter the keystore password: "); return new String(System.console().readPassword()); } }
public class ConsoleDemo { public static void main(String[] args) { String[] data = { "\u250C\u2500\u2500\u2500\u2500\u2500\u2510", "\u2502Hello\u2502", "\u2514\u2500\u2500\u2500\u2500\u2500\u2518" }; for (String s : data) { System.out.println(s); } for (String s : data) { System.console().writer().println(s); } } }
/** */ public static @Nullable GridConsoleAdapter getInstance() { Console console = System.console(); return console == null ? null : new GridConsoleAdapter(console); }
private void showWelcomeMessage() { final Console console = System.console(); if (console == null) { return; } final PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out, StandardCharsets.UTF_8)); WelcomeMsgUtils.displayWelcomeMessage(80, writer); writer.printf("Server %s started with query file %s. Interactive mode is disabled.%n", Version.getVersion(), queriesFile); writer.flush(); }
private DiagnosticsReporterProgress buildProgress() { DiagnosticsReporterProgress progress; if ( System.console() != null ) { progress = new InteractiveProgress( out, verbose ); } else { progress = new NonInteractiveProgress( out, verbose ); } return progress; }
@Test public void testGetMappedProperty_sun_stdout_encoding() { final PropertiesUtil pu = new PropertiesUtil(System.getProperties()); Charset expected = System.console() == null ? Charset.defaultCharset() : StandardCharsets.UTF_8; assertEquals(expected, pu.getCharsetProperty("sun.stdout.encoding")); }
@Test public void testGetMappedProperty_sun_stderr_encoding() { final PropertiesUtil pu = new PropertiesUtil(System.getProperties()); Charset expected = System.console() == null ? Charset.defaultCharset() : StandardCharsets.UTF_8; assertEquals(expected, pu.getCharsetProperty("sun.err.encoding")); }