Package stdlib
Class StdIn
java.lang.Object
stdlib.StdIn
Standard input. This class provides methods for reading strings
  and numbers from standard input. See
  Section 1.5 of
  Introduction to Programming in Java: An Interdisciplinary Approach
  by Robert Sedgewick and Kevin Wayne.
  
  See the technical information in the documentation of the In
  class, which applies to this class as well.
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidRedirect to a file.static voidfromString(String s) Redirect to a string.static booleanIs the input empty (including whitespace)? Use this to know whether the next call toreadChar()will succeed.static booleanDoes the input have a next line? Use this to know whether the next call toreadLine()will succeed.static booleanisEmpty()Is the input empty (except possibly for whitespace)? Use this to know whether the next call toreadString(),readDouble(), etc will succeed.static voidInteractive test of basic functionality.static StringreadAll()Read and return the remainder of the input as a string.static double[]Read all doubles until the end of input is reached, and return them.static int[]Read all ints until the end of input is reached, and return them.static String[]Read all strings until the end of input is reached, and return them.static booleanRead and return the next boolean, allowing case-insensitive "true" or "1" for true, and "false" or "0" for false.static bytereadByte()Read and return the next byte.static charreadChar()Read and return the next character.static doubleRead and return the next double.static double[]Deprecated.static floatRead and return the next float.static intreadInt()Read and return the next int.static int[]readInts()Deprecated.For more consistency, usereadAllInts()static StringreadLine()Read and return the next line.static longreadLong()Read and return the next long.static shortRead and return the next short.static StringRead and return the next string.static String[]Deprecated.For more consistency, usereadAllStrings()
- 
Method Details- 
isEmptyIs the input empty (except possibly for whitespace)? Use this to know whether the next call toreadString(),readDouble(), etc will succeed.
- 
hasNextLineDoes the input have a next line? Use this to know whether the next call toreadLine()will succeed.Functionally equivalent to hasNextChar().
- 
hasNextCharIs the input empty (including whitespace)? Use this to know whether the next call toreadChar()will succeed.Functionally equivalent to hasNextLine().
- 
readLineRead and return the next line.
- 
readCharRead and return the next character.
- 
readAllRead and return the remainder of the input as a string.
- 
readStringRead and return the next string.
- 
readIntRead and return the next int.
- 
readDoubleRead and return the next double.
- 
readFloatRead and return the next float.
- 
readLongRead and return the next long.
- 
readShortRead and return the next short.
- 
readByteRead and return the next byte.
- 
readBooleanRead and return the next boolean, allowing case-insensitive "true" or "1" for true, and "false" or "0" for false.
- 
readAllStringsRead all strings until the end of input is reached, and return them.
- 
readAllIntsRead all ints until the end of input is reached, and return them.
- 
readAllDoublesRead all doubles until the end of input is reached, and return them.
- 
readIntsDeprecated.For more consistency, usereadAllInts()Reads all ints from stdin.
- 
readDoublesDeprecated.For more consistency, usereadAllDoubles()Reads all doubles from stdin.
- 
readStringsDeprecated.For more consistency, usereadAllStrings()Reads all Strings from stdin.
- 
fromFileRedirect to a file. This is a hack to get programs to work easily in eclipse. (Added by James Riely 2012/01/12.)
- 
fromStringRedirect to a string. This is a hack to get programs to work easily in eclipse. (Added by James Riely 2012/01/12.)
- 
mainInteractive test of basic functionality.
 
- 
readAllDoubles()