java.io.Console.setEcho()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中java.io.Console.setEcho()方法的一些代码示例,展示了Console.setEcho()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Console.setEcho()方法的具体详情如下:
包路径:java.io.Console
类名称:Console
方法名:setEcho

Console.setEcho介绍

暂无

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Reads a password from the console. The password will not be echoed to the display.
 *
 * @return a character array containing the password, or null at EOF.
 */
public char[] readPassword() {
  synchronized (CONSOLE_LOCK) {
    int previousState = setEcho(false, 0);
    try {
      String password = readLine();
      writer.println(); // We won't have echoed the user's newline.
      return (password == null) ? null : password.toCharArray();
    } finally {
      setEcho(true, previousState);
    }
  }
}

代码示例来源:origin: MobiVM/robovm

/**
 * Reads a password from the console. The password will not be echoed to the display.
 *
 * @return a character array containing the password, or null at EOF.
 */
public char[] readPassword() {
  synchronized (CONSOLE_LOCK) {
    int previousState = setEcho(false, 0);
    try {
      String password = readLine();
      writer.println(); // We won't have echoed the user's newline.
      return (password == null) ? null : password.toCharArray();
    } finally {
      setEcho(true, previousState);
    }
  }
}

代码示例来源:origin: ibinti/bugvm

/**
 * Reads a password from the console. The password will not be echoed to the display.
 *
 * @return a character array containing the password, or null at EOF.
 */
public char[] readPassword() {
  synchronized (CONSOLE_LOCK) {
    int previousState = setEcho(false, 0);
    try {
      String password = readLine();
      writer.println(); // We won't have echoed the user's newline.
      return (password == null) ? null : password.toCharArray();
    } finally {
      setEcho(true, previousState);
    }
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Reads a password from the console. The password will not be echoed to the display.
 *
 * @return a character array containing the password, or null at EOF.
 */
public char[] readPassword() {
  synchronized (CONSOLE_LOCK) {
    int previousState = setEcho(false, 0);
    try {
      String password = readLine();
      writer.println(); // We won't have echoed the user's newline.
      return (password == null) ? null : password.toCharArray();
    } finally {
      setEcho(true, previousState);
    }
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Reads a password from the console. The password will not be echoed to the display.
 *
 * @return a character array containing the password, or null at EOF.
 */
public char[] readPassword() {
  synchronized (CONSOLE_LOCK) {
    int previousState = setEcho(false, 0);
    try {
      String password = readLine();
      writer.println(); // We won't have echoed the user's newline.
      return (password == null) ? null : password.toCharArray();
    } finally {
      setEcho(true, previousState);
    }
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Reads a password from the console. The password will not be echoed to the display.
 *
 * @return a character array containing the password, or null at EOF.
 */
public char[] readPassword() {
  synchronized (CONSOLE_LOCK) {
    int previousState = setEcho(false, 0);
    try {
      String password = readLine();
      writer.println(); // We won't have echoed the user's newline.
      return (password == null) ? null : password.toCharArray();
    } finally {
      setEcho(true, previousState);
    }
  }
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Reads a password from the console. The password will not be echoed to the display.
 *
 * @return a character array containing the password, or null at EOF.
 */
public char[] readPassword() {
  synchronized (CONSOLE_LOCK) {
    int previousState = setEcho(false, 0);
    try {
      String password = readLine();
      writer.println(); // We won't have echoed the user's newline.
      return (password == null) ? null : password.toCharArray();
    } finally {
      setEcho(true, previousState);
    }
  }
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Reads a password from the console. The password will not be echoed to the display.
 *
 * @return a character array containing the password, or null at EOF.
 */
public char[] readPassword() {
  synchronized (CONSOLE_LOCK) {
    int previousState = setEcho(false, 0);
    try {
      String password = readLine();
      writer.println(); // We won't have echoed the user's newline.
      return (password == null) ? null : password.toCharArray();
    } finally {
      setEcho(true, previousState);
    }
  }
}

相关文章