Scanner

http://tool.oschina.net/apidocs/apidoc?api=jdk_7u4

Constructor Summary

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.
String findInLine(String pattern)
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 next token in this scanner's input can be interpreted as a float value using the  nextFloat() method.
boolean hasNextInt()
Returns true if the next token in this scanner's input can be interpreted as an int value in the default radix using the  nextInt()method.
boolean hasNextInt(int radix)
Returns true if the next token in this scanner's input can be interpreted as an int value in the specified radix using the  nextInt()method.
boolean hasNextLine()
Returns true if there is another line in the input of this scanner.
boolean hasNextLong()
Returns true if the next token in this scanner's input can be interpreted as a long value in the default radix using the  nextLong()method.
boolean hasNextLong(int radix)
Returns true if the next token in this scanner's input can be interpreted as a long value in the specified radix using the nextLong() method.
boolean hasNextShort()
Returns true if the next token in this scanner's input can be interpreted as a short value in the default radix using the nextShort() method.
boolean hasNextShort(int radix)
Returns true if the next token in this scanner's input can be interpreted as a short value in the specified radix using the nextShort() method.
IOException ioException()
Returns the  IOException last thrown by this  Scanner's underlying  Readable.
Locale locale()
Returns this scanner's locale.
MatchResult match()
Returns the match result of the last scanning operation performed by this scanner.
String next()
Finds and returns the next complete token from this scanner.
String next(Pattern pattern)
Returns the next token if it matches the specified pattern.
String next(String pattern)
Returns the next token if it matches the pattern constructed from the specified string.
BigDecimal nextBigDecimal()
Scans the next token of the input as a  BigDecimal.
BigInteger nextBigInteger()
Scans the next token of the input as a  BigInteger.
BigInteger nextBigInteger(int radix)
Scans the next token of the input as a  BigInteger.
boolean nextBoolean()
Scans the next token of the input into a boolean value and returns that value.
byte nextByte()
Scans the next token of the input as a  byte.
byte nextByte(int radix)
Scans the next token of the input as a  byte.
double nextDouble()
Scans the next token of the input as a  double.
float nextFloat()
Scans the next token of the input as a  float.
int nextInt()
Scans the next token of the input as an  int.
int nextInt(int radix)
Scans the next token of the input as an  int.
String nextLine()
Advances this scanner past the current line and returns the input that was skipped.
long nextLong()
Scans the next token of the input as a  long.
long nextLong(int radix)
Scans the next token of the input as a  long.
short nextShort()
Scans the next token of the input as a  short.
short nextShort(int radix)
Scans the next token of the input as a  short.
int radix()
Returns this scanner's default radix.
void remove()
The remove operation is not supported by this implementation of  Iterator.
Scanner reset()
Resets this scanner.
Scanner skip(Pattern pattern)
Skips input that matches the specified pattern, ignoring delimiters.
Scanner skip(String pattern)
Skips input that matches a pattern constructed from the specified string.
String toString()
Returns the string representation of this  Scanner.
Scanner useDelimiter(Pattern pattern)
Sets this scanner's delimiting pattern to the specified pattern.
Scanner useDelimiter(String pattern)
Sets this scanner's delimiting pattern to a pattern constructed from the specified  String.
Scanner useLocale(Locale locale)
Sets this scanner's locale to the specified locale.
Scanner useRadix(int radix)
Sets this scanner's default radix to the specified radix.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值