android.net
public
static
class
android.net.UrlQuerySanitizer.IllegalCharacterValueSanitizer
Sanitize values based on which characters they contain. Illegal
characters are replaced with either space or '_', depending upon
whether space is a legal character or not.
Summary
Constants
|
|
|
Value |
|
int |
ALL_BUT_NUL_AND_ANGLE_BRACKETS_LEGAL |
|
1439 |
0x0000059f |
int |
ALL_BUT_NUL_LEGAL |
- Allow all special characters except Nul.
|
1535 |
0x000005ff |
int |
ALL_BUT_WHITESPACE_LEGAL |
- Allow all special characters except for:
- whitespace characters
- Nul ('\0')
- Allow script URLs.
|
1532 |
0x000005fc |
int |
ALL_ILLEGAL |
- Deny all special characters.
|
0 |
0x00000000 |
int |
ALL_OK |
Mask with all fields set to OK
|
2047 |
0x000007ff |
int |
ALL_WHITESPACE_OK |
Mask with both regular space and other whitespace OK
|
3 |
0x00000003 |
int |
AMP_AND_SPACE_LEGAL |
|
129 |
0x00000081 |
int |
AMP_LEGAL |
|
128 |
0x00000080 |
int |
AMP_OK |
Allow ampersand characters ('&')
|
128 |
0x00000080 |
int |
DQUOTE_OK |
Allow double quote characters. |
8 |
0x00000008 |
int |
GT_OK |
Allow greater-than characters. |
64 |
0x00000040 |
int |
LT_OK |
Allow less-than characters. |
32 |
0x00000020 |
int |
NON_7_BIT_ASCII_OK |
Allow characters with character codes 128 to 255. |
4 |
0x00000004 |
int |
NUL_OK |
Allow nul characters ('\0')
|
512 |
0x00000200 |
int |
OTHER_WHITESPACE_OK |
Allow whitespace characters other than space. |
2 |
0x00000002 |
int |
PCT_OK |
Allow percent-sign characters ('%')
|
256 |
0x00000100 |
int |
SCRIPT_URL_OK |
Allow text to start with a script URL
such as "javascript:" or "vbscript:"
|
1024 |
0x00000400 |
int |
SPACE_LEGAL |
|
1 |
0x00000001 |
int |
SPACE_OK |
Allow space (' ') characters. |
1 |
0x00000001 |
int |
SQUOTE_OK |
Allow single quote characters. |
16 |
0x00000010 |
int |
URL_AND_SPACE_LEGAL |
- Allow characters used by encoded URLs.
|
405 |
0x00000195 |
int |
URL_LEGAL |
- Allow characters used by encoded URLs.
|
404 |
0x00000194 |
Public Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Constants
public
static
final
int
ALL_BUT_NUL_AND_ANGLE_BRACKETS_LEGAL
- Allow all but.
- Nul ('\0')
- Angle brackets ('<', '>')
- Deny script URLs.
Constant Value:
1439
(0x0000059f)
public
static
final
int
ALL_BUT_NUL_LEGAL
- Allow all special characters except Nul. ('\0').
- Allow script URLs.
Constant Value:
1535
(0x000005ff)
public
static
final
int
ALL_BUT_WHITESPACE_LEGAL
- Allow all special characters except for:
- whitespace characters
- Nul ('\0')
- Allow script URLs.
Constant Value:
1532
(0x000005fc)
public
static
final
int
ALL_ILLEGAL
- Deny all special characters.
- Deny script URLs.
Constant Value:
0
(0x00000000)
public
static
final
int
ALL_OK
Mask with all fields set to OK
Constant Value:
2047
(0x000007ff)
public
static
final
int
ALL_WHITESPACE_OK
Mask with both regular space and other whitespace OK
Constant Value:
3
(0x00000003)
public
static
final
int
AMP_AND_SPACE_LEGAL
- Allow ampersand.
- Allow space.
- Deny script URLs.
Constant Value:
129
(0x00000081)
public
static
final
int
AMP_LEGAL
- Allow ampersand.
- Deny script URLs.
Constant Value:
128
(0x00000080)
public
static
final
int
AMP_OK
Allow ampersand characters ('&')
Constant Value:
128
(0x00000080)
public
static
final
int
DQUOTE_OK
Allow double quote characters. ('"')
Constant Value:
8
(0x00000008)
public
static
final
int
GT_OK
Allow greater-than characters. ('>')
Constant Value:
64
(0x00000040)
public
static
final
int
LT_OK
Allow less-than characters. ('<')
Constant Value:
32
(0x00000020)
public
static
final
int
NON_7_BIT_ASCII_OK
Allow characters with character codes 128 to 255.
Constant Value:
4
(0x00000004)
public
static
final
int
NUL_OK
Allow nul characters ('\0')
Constant Value:
512
(0x00000200)
public
static
final
int
OTHER_WHITESPACE_OK
Allow whitespace characters other than space. The
other whitespace characters are
'\t' '\f' '\n' '\r' and '\0x000b' (vertical tab)
Constant Value:
2
(0x00000002)
public
static
final
int
PCT_OK
Allow percent-sign characters ('%')
Constant Value:
256
(0x00000100)
public
static
final
int
SCRIPT_URL_OK
Allow text to start with a script URL
such as "javascript:" or "vbscript:"
Constant Value:
1024
(0x00000400)
public
static
final
int
SPACE_LEGAL
- Allow space.
- Deny script URLs.
Constant Value:
1
(0x00000001)
public
static
final
int
SPACE_OK
Allow space (' ') characters.
Constant Value:
1
(0x00000001)
public
static
final
int
SQUOTE_OK
Allow single quote characters. ('\'')
Constant Value:
16
(0x00000010)
public
static
final
int
URL_AND_SPACE_LEGAL
- Allow characters used by encoded URLs.
- Allow spaces.
- Deny script URLs.
Constant Value:
405
(0x00000195)
public
static
final
int
URL_LEGAL
- Allow characters used by encoded URLs.
- Deny script URLs.
Constant Value:
404
(0x00000194)
Public Constructors
public
UrlQuerySanitizer.IllegalCharacterValueSanitizer(int flags)
Construct a sanitizer. The parameters set the behavior of the
sanitizer.
Parameters
flags
| some combination of the XXX_OK flags.
|
Public Methods
Sanitize a value.
- If script URLs are not OK, the will be removed.
- If neither spaces nor other white space is OK, then
white space will be trimmed from the beginning and end of
the URL. (Just the actual white space characters are trimmed, not
other control codes.)
- Illegal characters will be replaced with
either ' ' or '_', depending on whether a space is itself a
legal character.