Udostępnij za pośrednictwem


Scanner.NextByte Method

Definition

Overloads

NextByte()

Scans the next token of the input as a byte.

NextByte(Int32)

Scans the next token of the input as a byte.

NextByte()

Scans the next token of the input as a byte.

[Android.Runtime.Register("nextByte", "()B", "")]
public sbyte NextByte ();
[<Android.Runtime.Register("nextByte", "()B", "")>]
member this.NextByte : unit -> sbyte

Returns

the byte scanned from the input

Attributes

Exceptions

if this Scanner has been closed.

if input has been exhausted.

if the next token can not be translated into a valid byte value.

Remarks

Scans the next token of the input as a byte.

An invocation of this method of the form nextByte() behaves in exactly the same way as the invocation nextByte(radix), where radix is the default radix of this scanner.

Java documentation for java.util.Scanner.nextByte().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

NextByte(Int32)

Scans the next token of the input as a byte.

[Android.Runtime.Register("nextByte", "(I)B", "")]
public sbyte NextByte (int radix);
[<Android.Runtime.Register("nextByte", "(I)B", "")>]
member this.NextByte : int -> sbyte

Parameters

radix
Int32

the radix used to interpret the token as a byte value

Returns

the byte scanned from the input

Attributes

Exceptions

if this Scanner has been closed.

if input has been exhausted.

if the next token can not be translated into a valid byte value.

Remarks

Scans the next token of the input as a byte. This method will throw InputMismatchException if the next token cannot be translated into a valid byte value as described below. If the translation is successful, the scanner advances past the input that matched.

If the next token matches the <i>Integer</i> regular expression defined above then the token is converted into a byte value as if by removing all locale specific prefixes, group separators, and locale specific suffixes, then mapping non-ASCII digits into ASCII digits via Character#digit Character.digit, prepending a negative sign (-) if the locale specific negative prefixes and suffixes were present, and passing the resulting string to Byte#parseByte(String, int) Byte.parseByte with the specified radix.

If the radix is less than Character#MIN_RADIX Character.MIN_RADIX or greater than Character#MAX_RADIX Character.MAX_RADIX, then an IllegalArgumentException is thrown.

Java documentation for java.util.Scanner.nextByte(.*int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to