IllegalCharacterValueSanitizer
open class IllegalCharacterValueSanitizer : UrlQuerySanitizer.ValueSanitizer
kotlin.Any | |
↳ | 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 | |
---|---|
static Int |
|
static Int |
|
static Int |
|
static Int |
|
static Int |
Mask with all fields set to OK |
static Int |
Mask with both regular space and other whitespace OK |
static Int |
|
static Int |
|
static Int |
Allow ampersand characters ('&') |
static Int |
Allow double quote characters. |
static Int |
Allow greater-than characters. |
static Int |
Allow less-than characters. |
static Int |
Allow characters with character codes 128 to 255. |
static Int |
Allow nul characters ('\0') |
static Int |
Allow whitespace characters other than space. |
static Int |
Allow percent-sign characters ('%') |
static Int |
Allow text to start with a script URL such as "javascript:" or "vbscript:" |
static Int |
|
static Int |
Allow space (' ') characters. |
static Int |
Allow single quote characters. |
static Int |
|
static Int |
|
Public constructors | |
---|---|
IllegalCharacterValueSanitizer(flags: Int) Construct a sanitizer. |
Public methods | |
---|---|
open String! |
Sanitize a value. |
Constants
ALL_BUT_NUL_AND_ANGLE_BRACKETS_LEGAL
static val ALL_BUT_NUL_AND_ANGLE_BRACKETS_LEGAL: Int
- Allow all but.
- Nul ('\0')
- Angle brackets ('<', '>')
- Deny script URLs.
Value: 1439
ALL_BUT_NUL_LEGAL
static val ALL_BUT_NUL_LEGAL: Int
- Allow all special characters except Nul. ('\0').
- Allow script URLs.
Value: 1535
ALL_BUT_WHITESPACE_LEGAL
static val ALL_BUT_WHITESPACE_LEGAL: Int
- Allow all special characters except for:
- whitespace characters
- Nul ('\0')
- Allow script URLs.
Value: 1532
ALL_ILLEGAL
static val ALL_ILLEGAL: Int
- Deny all special characters.
- Deny script URLs.
Value: 0
ALL_WHITESPACE_OK
static val ALL_WHITESPACE_OK: Int
Mask with both regular space and other whitespace OK
Value: 3
AMP_AND_SPACE_LEGAL
static val AMP_AND_SPACE_LEGAL: Int
- Allow ampersand.
- Allow space.
- Deny script URLs.
Value: 129
AMP_LEGAL
static val AMP_LEGAL: Int
- Allow ampersand.
- Deny script URLs.
Value: 128
DQUOTE_OK
static val DQUOTE_OK: Int
Allow double quote characters. ('"')
Value: 8
NON_7_BIT_ASCII_OK
static val NON_7_BIT_ASCII_OK: Int
Allow characters with character codes 128 to 255.
Value: 4
OTHER_WHITESPACE_OK
static val OTHER_WHITESPACE_OK: Int
Allow whitespace characters other than space. The other whitespace characters are '\t' '\f' '\n' '\r' and '\0x000b' (vertical tab)
Value: 2
SCRIPT_URL_OK
static val SCRIPT_URL_OK: Int
Allow text to start with a script URL such as "javascript:" or "vbscript:"
Value: 1024
SPACE_LEGAL
static val SPACE_LEGAL: Int
- Allow space.
- Deny script URLs.
Value: 1
SQUOTE_OK
static val SQUOTE_OK: Int
Allow single quote characters. ('\'')
Value: 16
URL_AND_SPACE_LEGAL
static val URL_AND_SPACE_LEGAL: Int
- Allow characters used by encoded URLs.
- Allow spaces.
- Deny script URLs.
Value: 405
URL_LEGAL
static val URL_LEGAL: Int
- Allow characters used by encoded URLs.
- Deny script URLs.
Value: 404
Public constructors
IllegalCharacterValueSanitizer
IllegalCharacterValueSanitizer(flags: Int)
Construct a sanitizer. The parameters set the behavior of the sanitizer.
Parameters | |
---|---|
flags |
Int: some combination of the XXX_OK flags. |
Public methods
sanitize
open fun sanitize(value: String!): String!
Sanitize a value.
- If script URLs are not OK, they 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.
Parameters | |
---|---|
value |
String!: |
Return | |
---|---|
String! |
the sanitized value |