Example #1
0
 /**
  * Skips whitespace characters and then reads a value of type boolean from input, discarding the
  * rest of the current line of input (including the next end-of-line character, if any). When
  * using standard IO, this will not produce an error; the user will be prompted repeatedly for
  * input until a legal value is input. In other cases, an IllegalArgumentException will be thrown
  * if a legal value is not found.
  *
  * <p>Legal inputs for a boolean input are: true, t, yes, y, 1, false, f, no, n, and 0; letters
  * can be either upper case or lower case. One "word" of input is read, using the getWord()
  * method, and it must be one of these; note that the "word" must be terminated by a whitespace
  * character (or end-of-file).
  */
 public static boolean getlnBoolean() {
   boolean x = getBoolean();
   emptyBuffer();
   return x;
 }
Example #2
0
 /**
  * Skips whitespace characters and then reads one "word" from input, discarding the rest of the
  * current line of input (including the next end-of-line character, if any). A word is defined as
  * a sequence of non-whitespace characters (not just letters!). When using standard IO, this will
  * not produce an error. In other cases, an IllegalArgumentException will be thrown if an
  * end-of-file is encountered.
  */
 public static String getlnWord() {
   String x = getWord();
   emptyBuffer();
   return x;
 }
Example #3
0
 /**
  * Skips whitespace characters and then reads a value of type double from input, discarding the
  * rest of the current line of input (including the next end-of-line character, if any). When
  * using standard IO, this will not produce an error; the user will be prompted repeatedly for
  * input until a legal value is input. In other cases, an IllegalArgumentException will be thrown
  * if a legal value is not found.
  */
 public static double getlnDouble() {
   double x = getDouble();
   emptyBuffer();
   return x;
 }
Example #4
0
 /**
  * Skips whitespace characters and then reads a value of type char from input, discarding the rest
  * of the current line of input (including the next end-of-line character, if any). Note that the
  * value that is returned will be a non-whitespace character; compare this with the getAnyChar()
  * method. When using standard IO, this will not produce an error. In other cases, an error can
  * occur if an end-of-file is encountered.
  */
 public static char getlnChar() {
   char x = getChar();
   emptyBuffer();
   return x;
 }
Example #5
0
 /**
  * Skips whitespace characters and then reads a value of type float from input, discarding the
  * rest of the current line of input (including the next end-of-line character, if any). When
  * using standard IO, this will not produce an error; the user will be prompted repeatedly for
  * input until a legal value is input. In other cases, an IllegalArgumentException will be thrown
  * if a legal value is not found.
  */
 public static float getlnFloat() {
   float x = getFloat();
   emptyBuffer();
   return x;
 }
Example #6
0
 /**
  * Skips whitespace characters and then reads a value of type long from input, discarding the rest
  * of the current line of input (including the next end-of-line character, if any). When using
  * standard IO, this will not produce an error; the user will be prompted repeatedly for input
  * until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a
  * legal value is not found.
  */
 public static long getlnLong() {
   long x = getLong();
   emptyBuffer();
   return x;
 }
Example #7
0
 /**
  * Skips whitespace characters and then reads a value of type int from input, discarding the rest
  * of the current line of input (including the next end-of-line character, if any). When using
  * standard IO, this will not produce an error; the user will be prompted repeatedly for input
  * until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a
  * legal value is not found.
  */
 public static int getlnInt() {
   int x = getInt();
   emptyBuffer();
   return x;
 }
Example #8
0
 /**
  * Skips whitespace characters and then reads a value of type short from input, discarding the
  * rest of the current line of input (including the next end-of-line character, if any). When
  * using standard IO, this will not produce an error; the user will be prompted repeatedly for
  * input until a legal value is input. In other cases, an IllegalArgumentException will be thrown
  * if a legal value is not found.
  */
 public static short getlnShort() {
   short x = getShort();
   emptyBuffer();
   return x;
 }
Example #9
0
 /**
  * Skips whitespace characters and then reads a value of type byte from input, discarding the rest
  * of the current line of input (including the next end-of-line character, if any). When using
  * standard IO, this will not produce an error; the user will be prompted repeatedly for input
  * until a legal value is input. In other cases, an IllegalArgumentException will be thrown if a
  * legal value is not found.
  */
 public static byte getlnByte() {
   byte x = getByte();
   emptyBuffer();
   return x;
 }