Constructors Constructor and Description
Scanner(File source)
Constructs a new Scanner that produces values scanned from the specified file.
Scanner(File source, String charsetName)
Constructs a new Scanner that produces values scanned from the specified file.
Scanner(InputStream source)
Constructs a new Scanner that produces values scanned from the specified input stream.
Scanner(InputStream source, String charsetName)
Constructs a new Scanner that produces values scanned from the specified input stream.
Scanner(Path source)
Constructs a new Scanner that produces values scanned from the specified file.
Scanner(Path source, String charsetName)
Constructs a new Scanner that produces values scanned from the specified file.
Scanner(Readable source)
Constructs a new Scanner that produces values scanned from the specified source.
Scanner(ReadableByteChannel source)
Constructs a new Scanner that produces values scanned from the specified channel.
Scanner(ReadableByteChannel source, String charsetName)
Constructs a new Scanner that produces values scanned from the specified channel.
Scanner(String source)
Constructs a new Scanner that produces values scanned from the specified string.
Method Summary
Methods Modifier and Type Method and Description
void close()
Closes this scanner.
Pattern delimiter()
Returns the Pattern this Scanner is currently using to match delimiters.
String findInLine(Pattern pattern)
Attempts to find the next occurrence of the specified pattern ignoring delimiters.
Attempts to find the next occurrence of a pattern constructed from the specified string, ignoring delimiters.
String findWithinHorizon(Pattern pattern, int horizon)
Attempts to find the next occurrence of the specified pattern.
String findWithinHorizon(String pattern, int horizon)
Attempts to find the next occurrence of a pattern constructed from the specified string, ignoring delimiters.
boolean hasNext()
Returns true if this scanner has another token in its input.
boolean hasNext(Pattern pattern)
Returns true if the next complete token matches the specified pattern.
boolean hasNext(String pattern)
Returns true if the next token matches the pattern constructed from the specified string.
boolean hasNextBigDecimal()
Returns true if the next token in this scanner's input can be interpreted as a BigDecimal using the nextBigDecimal() method.
boolean hasNextBigInteger()
Returns true if the next token in this scanner's input can be interpreted as a BigInteger in the default radix using the nextBigInteger() method.
boolean hasNextBigInteger(int radix)
Returns true if the next token in this scanner's input can be interpreted as a BigInteger in the specified radix using the nextBigInteger() method.
boolean hasNextBoolean()
Returns true if the next token in this scanner's input can be interpreted as a boolean value using a case insensitive pattern created from the string "true|false".
boolean hasNextByte()
Returns true if the next token in this scanner's input can be interpreted as a byte value in the default radix using the nextByte() method.
boolean hasNextByte(int radix)
Returns true if the next token in this scanner's input can be interpreted as a byte value in the specified radix using the nextByte() method.
boolean hasNextDouble()
Returns true if the next token in this scanner's input can be interpreted as a double value using the nextDouble() method.
boolean hasNextFloat()
Returns true if the n