Java Code Examples for java.lang.Character#isSpaceChar()
The following examples show how to use
java.lang.Character#isSpaceChar() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: URI.java From Java8CN with Apache License 2.0 | 6 votes |
private int scanEscape(int start, int n, char first) throws URISyntaxException { int p = start; char c = first; if (c == '%') { // Process escape pair if ((p + 3 <= n) && match(charAt(p + 1), L_HEX, H_HEX) && match(charAt(p + 2), L_HEX, H_HEX)) { return p + 3; } fail("Malformed escape pair", p); } else if ((c > 128) && !Character.isSpaceChar(c) && !Character.isISOControl(c)) { // Allow unescaped but visible non-US-ASCII chars return p + 1; } return p; }
Example 2
Source File: URI.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private int scanEscape(int start, int n, char first) throws URISyntaxException { int p = start; char c = first; if (c == '%') { // Process escape pair if ((p + 3 <= n) && match(charAt(p + 1), L_HEX, H_HEX) && match(charAt(p + 2), L_HEX, H_HEX)) { return p + 3; } fail("Malformed escape pair", p); } else if ((c > 128) && !Character.isSpaceChar(c) && !Character.isISOControl(c)) { // Allow unescaped but visible non-US-ASCII chars return p + 1; } return p; }
Example 3
Source File: URI.java From jdk-1.7-annotated with Apache License 2.0 | 6 votes |
private int scanEscape(int start, int n, char first) throws URISyntaxException { int p = start; char c = first; if (c == '%') { // Process escape pair if ((p + 3 <= n) && match(charAt(p + 1), L_HEX, H_HEX) && match(charAt(p + 2), L_HEX, H_HEX)) { return p + 3; } fail("Malformed escape pair", p); } else if ((c > 128) && !Character.isSpaceChar(c) && !Character.isISOControl(c)) { // Allow unescaped but visible non-US-ASCII chars return p + 1; } return p; }
Example 4
Source File: URI.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private int scanEscape(int start, int n, char first) throws URISyntaxException { int p = start; char c = first; if (c == '%') { // Process escape pair if ((p + 3 <= n) && match(charAt(p + 1), L_HEX, H_HEX) && match(charAt(p + 2), L_HEX, H_HEX)) { return p + 3; } fail("Malformed escape pair", p); } else if ((c > 128) && !Character.isSpaceChar(c) && !Character.isISOControl(c)) { // Allow unescaped but visible non-US-ASCII chars return p + 1; } return p; }
Example 5
Source File: URI.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private int scanEscape(int start, int n, char first) throws URISyntaxException { int p = start; char c = first; if (c == '%') { // Process escape pair if ((p + 3 <= n) && match(input.charAt(p + 1), L_HEX, H_HEX) && match(input.charAt(p + 2), L_HEX, H_HEX)) { return p + 3; } fail("Malformed escape pair", p); } else if ((c > 128) && !Character.isSpaceChar(c) && !Character.isISOControl(c)) { // Allow unescaped but visible non-US-ASCII chars return p + 1; } return p; }
Example 6
Source File: URI.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private int scanEscape(int start, int n, char first) throws URISyntaxException { int p = start; char c = first; if (c == '%') { // Process escape pair if ((p + 3 <= n) && match(charAt(p + 1), L_HEX, H_HEX) && match(charAt(p + 2), L_HEX, H_HEX)) { return p + 3; } fail("Malformed escape pair", p); } else if ((c > 128) && !Character.isSpaceChar(c) && !Character.isISOControl(c)) { // Allow unescaped but visible non-US-ASCII chars return p + 1; } return p; }
Example 7
Source File: URI.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private int scanEscape(int start, int n, char first) throws URISyntaxException { int p = start; char c = first; if (c == '%') { // Process escape pair if ((p + 3 <= n) && match(charAt(p + 1), L_HEX, H_HEX) && match(charAt(p + 2), L_HEX, H_HEX)) { return p + 3; } fail("Malformed escape pair", p); } else if ((c > 128) && !Character.isSpaceChar(c) && !Character.isISOControl(c)) { // Allow unescaped but visible non-US-ASCII chars return p + 1; } return p; }
Example 8
Source File: URI.java From hottub with GNU General Public License v2.0 | 6 votes |
private int scanEscape(int start, int n, char first) throws URISyntaxException { int p = start; char c = first; if (c == '%') { // Process escape pair if ((p + 3 <= n) && match(charAt(p + 1), L_HEX, H_HEX) && match(charAt(p + 2), L_HEX, H_HEX)) { return p + 3; } fail("Malformed escape pair", p); } else if ((c > 128) && !Character.isSpaceChar(c) && !Character.isISOControl(c)) { // Allow unescaped but visible non-US-ASCII chars return p + 1; } return p; }
Example 9
Source File: PatternEntry.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
static void appendQuoted(String chars, StringBuffer toAddTo) { boolean inQuote = false; char ch = chars.charAt(0); if (Character.isSpaceChar(ch)) { inQuote = true; toAddTo.append('\''); } else { if (PatternEntry.isSpecialChar(ch)) { inQuote = true; toAddTo.append('\''); } else { switch (ch) { case 0x0010: case '\f': case '\r': case '\t': case '\n': case '@': inQuote = true; toAddTo.append('\''); break; case '\'': inQuote = true; toAddTo.append('\''); break; default: if (inQuote) { inQuote = false; toAddTo.append('\''); } break; } } } toAddTo.append(chars); if (inQuote) toAddTo.append('\''); }
Example 10
Source File: URI.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static String quote(String s, long lowMask, long highMask) { int n = s.length(); StringBuffer sb = null; boolean allowNonASCII = ((lowMask & L_ESCAPED) != 0); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c < '\u0080') { if (!match(c, lowMask, highMask)) { if (sb == null) { sb = new StringBuffer(); sb.append(s.substring(0, i)); } appendEscape(sb, (byte)c); } else { if (sb != null) sb.append(c); } } else if (allowNonASCII && (Character.isSpaceChar(c) || Character.isISOControl(c))) { if (sb == null) { sb = new StringBuffer(); sb.append(s.substring(0, i)); } appendEncoded(sb, c); } else { if (sb != null) sb.append(c); } } return (sb == null) ? s : sb.toString(); }
Example 11
Source File: URI.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static String quote(String s, long lowMask, long highMask) { int n = s.length(); StringBuffer sb = null; boolean allowNonASCII = ((lowMask & L_ESCAPED) != 0); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c < '\u0080') { if (!match(c, lowMask, highMask)) { if (sb == null) { sb = new StringBuffer(); sb.append(s.substring(0, i)); } appendEscape(sb, (byte)c); } else { if (sb != null) sb.append(c); } } else if (allowNonASCII && (Character.isSpaceChar(c) || Character.isISOControl(c))) { if (sb == null) { sb = new StringBuffer(); sb.append(s.substring(0, i)); } appendEncoded(sb, c); } else { if (sb != null) sb.append(c); } } return (sb == null) ? s : sb.toString(); }
Example 12
Source File: PatternEntry.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
static void appendQuoted(String chars, StringBuffer toAddTo) { boolean inQuote = false; char ch = chars.charAt(0); if (Character.isSpaceChar(ch)) { inQuote = true; toAddTo.append('\''); } else { if (PatternEntry.isSpecialChar(ch)) { inQuote = true; toAddTo.append('\''); } else { switch (ch) { case 0x0010: case '\f': case '\r': case '\t': case '\n': case '@': inQuote = true; toAddTo.append('\''); break; case '\'': inQuote = true; toAddTo.append('\''); break; default: if (inQuote) { inQuote = false; toAddTo.append('\''); } break; } } } toAddTo.append(chars); if (inQuote) toAddTo.append('\''); }
Example 13
Source File: PatternEntry.java From hottub with GNU General Public License v2.0 | 5 votes |
static void appendQuoted(String chars, StringBuffer toAddTo) { boolean inQuote = false; char ch = chars.charAt(0); if (Character.isSpaceChar(ch)) { inQuote = true; toAddTo.append('\''); } else { if (PatternEntry.isSpecialChar(ch)) { inQuote = true; toAddTo.append('\''); } else { switch (ch) { case 0x0010: case '\f': case '\r': case '\t': case '\n': case '@': inQuote = true; toAddTo.append('\''); break; case '\'': inQuote = true; toAddTo.append('\''); break; default: if (inQuote) { inQuote = false; toAddTo.append('\''); } break; } } } toAddTo.append(chars); if (inQuote) toAddTo.append('\''); }
Example 14
Source File: PatternEntry.java From JDKSourceCode1.8 with MIT License | 5 votes |
static void appendQuoted(String chars, StringBuffer toAddTo) { boolean inQuote = false; char ch = chars.charAt(0); if (Character.isSpaceChar(ch)) { inQuote = true; toAddTo.append('\''); } else { if (PatternEntry.isSpecialChar(ch)) { inQuote = true; toAddTo.append('\''); } else { switch (ch) { case 0x0010: case '\f': case '\r': case '\t': case '\n': case '@': inQuote = true; toAddTo.append('\''); break; case '\'': inQuote = true; toAddTo.append('\''); break; default: if (inQuote) { inQuote = false; toAddTo.append('\''); } break; } } } toAddTo.append(chars); if (inQuote) toAddTo.append('\''); }
Example 15
Source File: URI.java From hottub with GNU General Public License v2.0 | 5 votes |
private static String quote(String s, long lowMask, long highMask) { int n = s.length(); StringBuffer sb = null; boolean allowNonASCII = ((lowMask & L_ESCAPED) != 0); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c < '\u0080') { if (!match(c, lowMask, highMask)) { if (sb == null) { sb = new StringBuffer(); sb.append(s.substring(0, i)); } appendEscape(sb, (byte)c); } else { if (sb != null) sb.append(c); } } else if (allowNonASCII && (Character.isSpaceChar(c) || Character.isISOControl(c))) { if (sb == null) { sb = new StringBuffer(); sb.append(s.substring(0, i)); } appendEncoded(sb, c); } else { if (sb != null) sb.append(c); } } return (sb == null) ? s : sb.toString(); }
Example 16
Source File: URI.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static String quote(String s, long lowMask, long highMask) { int n = s.length(); StringBuffer sb = null; boolean allowNonASCII = ((lowMask & L_ESCAPED) != 0); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c < '\u0080') { if (!match(c, lowMask, highMask)) { if (sb == null) { sb = new StringBuffer(); sb.append(s.substring(0, i)); } appendEscape(sb, (byte)c); } else { if (sb != null) sb.append(c); } } else if (allowNonASCII && (Character.isSpaceChar(c) || Character.isISOControl(c))) { if (sb == null) { sb = new StringBuffer(); sb.append(s.substring(0, i)); } appendEncoded(sb, c); } else { if (sb != null) sb.append(c); } } return (sb == null) ? s : sb.toString(); }
Example 17
Source File: URI.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static String quote(String s, long lowMask, long highMask) { int n = s.length(); StringBuffer sb = null; boolean allowNonASCII = ((lowMask & L_ESCAPED) != 0); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c < '\u0080') { if (!match(c, lowMask, highMask)) { if (sb == null) { sb = new StringBuffer(); sb.append(s.substring(0, i)); } appendEscape(sb, (byte)c); } else { if (sb != null) sb.append(c); } } else if (allowNonASCII && (Character.isSpaceChar(c) || Character.isISOControl(c))) { if (sb == null) { sb = new StringBuffer(); sb.append(s.substring(0, i)); } appendEncoded(sb, c); } else { if (sb != null) sb.append(c); } } return (sb == null) ? s : sb.toString(); }
Example 18
Source File: URI.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static String quote(String s, long lowMask, long highMask) { int n = s.length(); StringBuffer sb = null; boolean allowNonASCII = ((lowMask & L_ESCAPED) != 0); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c < '\u0080') { if (!match(c, lowMask, highMask)) { if (sb == null) { sb = new StringBuffer(); sb.append(s.substring(0, i)); } appendEscape(sb, (byte)c); } else { if (sb != null) sb.append(c); } } else if (allowNonASCII && (Character.isSpaceChar(c) || Character.isISOControl(c))) { if (sb == null) { sb = new StringBuffer(); sb.append(s.substring(0, i)); } appendEncoded(sb, c); } else { if (sb != null) sb.append(c); } } return (sb == null) ? s : sb.toString(); }
Example 19
Source File: URI.java From jdk-1.7-annotated with Apache License 2.0 | 5 votes |
private static String quote(String s, long lowMask, long highMask) { int n = s.length(); StringBuffer sb = null; boolean allowNonASCII = ((lowMask & L_ESCAPED) != 0); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c < '\u0080') { if (!match(c, lowMask, highMask)) { if (sb == null) { sb = new StringBuffer(); sb.append(s.substring(0, i)); } appendEscape(sb, (byte)c); } else { if (sb != null) sb.append(c); } } else if (allowNonASCII && (Character.isSpaceChar(c) || Character.isISOControl(c))) { if (sb == null) { sb = new StringBuffer(); sb.append(s.substring(0, i)); } appendEncoded(sb, c); } else { if (sb != null) sb.append(c); } } return (sb == null) ? s : sb.toString(); }
Example 20
Source File: PatternEntry.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static void appendQuoted(String chars, StringBuffer toAddTo) { boolean inQuote = false; char ch = chars.charAt(0); if (Character.isSpaceChar(ch)) { inQuote = true; toAddTo.append('\''); } else { if (PatternEntry.isSpecialChar(ch)) { inQuote = true; toAddTo.append('\''); } else { switch (ch) { case 0x0010: case '\f': case '\r': case '\t': case '\n': case '@': inQuote = true; toAddTo.append('\''); break; case '\'': inQuote = true; toAddTo.append('\''); break; default: if (inQuote) { inQuote = false; toAddTo.append('\''); } break; } } } toAddTo.append(chars); if (inQuote) toAddTo.append('\''); }