23.07.2013 Views

Java IO.pdf - Nguyen Dang Binh

Java IO.pdf - Nguyen Dang Binh

Java IO.pdf - Nguyen Dang Binh

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Java</strong> I/O<br />

The isWhitespace() method returns true if a character is a Unicode space separator<br />

character other than a nonbreaking space (160 and 65,279). It also returns true if the<br />

specified character is a line separator, a paragraph separator, a horizontal tab (\t, ASCII 9), a<br />

vertical tab (ASCII 11), a formfeed (ASCII 12), a carriage return (\r, ASCII 13), a linefeed<br />

(\n, ASCII 10), a file separator (ASCII 28), a group separator (ASCII 29), a record separator<br />

(ASCII 30), or a unit separator (ASCII 31).<br />

public static boolean isWhitespace(char ch)<br />

The isSpace() method is a less accurate version of isWhitespace() held over from <strong>Java</strong><br />

1.0. It returns true if its argument is a carriage return, linefeed, horizontal tab, formfeed, or<br />

ASCII space. Otherwise, it returns false. It's deprecated and should not be used in new code.<br />

public static boolean isSpace(char c)<br />

The isISOControl() method returns true if the specified character is an ISO Latin-1 control<br />

character; in other words, if it's in the range to 31 or 127 to 159.<br />

public static boolean isISOControl(char c)<br />

14.5.1.4 Identifiers<br />

Until <strong>Java</strong>, most programming languages were explicitly based on ASCII. Identifiers—e.g.,<br />

variable names, class names, method names, and so forth—were defined as being composed<br />

of some particular subset of these characters, generally allowing alphanumeric characters and<br />

some punctuation marks like the underscore but excluding the rest of ASCII. Furthermore,<br />

some languages distinguish between characters allowed in the middle of an identifier and<br />

characters that may start an identifier.<br />

The Unicode standard makes some suggestions for which Unicode characters should be<br />

allowed in programming language identifiers. Generally, all the alphanumeric characters from<br />

any script as well as certain joining characters and bidirectional indicators are allowed in<br />

identifiers, while most other characters are not. However, programming language designers<br />

are free to accept or reject the Unicode standard's suggestions in these matters.<br />

Character.isUnicodeIdentifierStart() returns true if the specified character may be<br />

the first character of an identifier; that is, if it is a Unicode letter.<br />

Character.isUnicodeIdentifierPart() returns true if the specified character may be<br />

part of the interior of a Unicode identifier; that is, the specified character is a letter, a digit, a<br />

numeric letter like a Roman numeral, a combining mark, an underscore, a nonspacing mark,<br />

or an ignorable control character.<br />

public static boolean isUnicodeIdentifierStart(char c)<br />

public static boolean isUnicodeIdentifierPart(char c)<br />

<strong>Java</strong>'s identifier syntax is not exactly the same as the Unicode identifier syntax, though they<br />

are similar; the <strong>Java</strong> identifier characters are a superset of the Unicode identifier characters.<br />

As well as the Unicode identifier characters, <strong>Java</strong> identifiers include currency symbols ($, £,<br />

¢, ¥, , the Bengali rupee sign, the Thai currency symbol baht, the EC sign, the colon sign,<br />

the cruzeiro sign, the French franc sign, the lira sign, the mill sign, the naira sign, the peseta<br />

sign, the Indian rupee sign, the won sign, the new shekel sign, the dong sign, etc.). <strong>Java</strong> start<br />

identifiers also include the connecting punctuation characters underscore, undertie, character<br />

352

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!