Most visited

Recently visited

Added in API level 1

UrlQuerySanitizer.IllegalCharacterValueSanitizer

public static class UrlQuerySanitizer.IllegalCharacterValueSanitizer
extends Object implements UrlQuerySanitizer.ValueSanitizer

java.lang.Object
   ↳ android.net.UrlQuerySanitizer.IllegalCharacterValueSanitizer


根据它们包含的字符来净化值。 非法字符被替换为空格或'_',这取决于空格是否是合法字符。

Summary

Constants

int ALL_BUT_NUL_AND_ANGLE_BRACKETS_LEGAL

  • Allow all but.

int ALL_BUT_NUL_LEGAL

  • Allow all special characters except Nul.

int ALL_BUT_WHITESPACE_LEGAL

  • Allow all special characters except for:
    • whitespace characters
    • Nul ('\0')
  • Allow script URLs.

int ALL_ILLEGAL

  • Deny all special characters.

int ALL_OK

所有字段设置为OK的掩码

int ALL_WHITESPACE_OK

具有常规空间和其他空白的掩码可以

int AMP_AND_SPACE_LEGAL

  • Allow ampersand.

int AMP_LEGAL

  • Allow ampersand.

int AMP_OK

允许&符号('&')

int DQUOTE_OK

允许双引号字符。

int GT_OK

允许大于号的字符。

int LT_OK

允许少于字符。

int NON_7_BIT_ASCII_OK

允许字符代码为128到255的字符。

int NUL_OK

允许nul个字符('\ 0')

int OTHER_WHITESPACE_OK

允许空格以外的空格字符。

int PCT_OK

允许百分号符号('%')

int SCRIPT_URL_OK

允许文本以脚本URL开头,如“javascript:”或“vbscript:”

int SPACE_LEGAL

  • Allow space.

int SPACE_OK

允许空格('')字符。

int SQUOTE_OK

允许单引号字符。

int URL_AND_SPACE_LEGAL

  • Allow characters used by encoded URLs.

int URL_LEGAL

  • Allow characters used by encoded URLs.

Public constructors

UrlQuerySanitizer.IllegalCharacterValueSanitizer(int flags)

构建一种消毒剂。

Public methods

String sanitize(String value)

净化价值。

Inherited methods

From class java.lang.Object
From interface android.net.UrlQuerySanitizer.ValueSanitizer

Constants

ALL_BUT_NUL_AND_ANGLE_BRACKETS_LEGAL

Added in API level 1
int ALL_BUT_NUL_AND_ANGLE_BRACKETS_LEGAL

  • Allow all but.
    • Nul ('\0')
    • Angle brackets ('<', '>')
  • Deny script URLs.

常量值:1439(0x0000059f)

ALL_BUT_NUL_LEGAL

Added in API level 1
int ALL_BUT_NUL_LEGAL

  • Allow all special characters except Nul. ('\0').
  • Allow script URLs.

常量值:1535(0x000005ff)

ALL_BUT_WHITESPACE_LEGAL

Added in API level 1
int ALL_BUT_WHITESPACE_LEGAL

  • Allow all special characters except for:
    • whitespace characters
    • Nul ('\0')
  • Allow script URLs.

常量值:1532(0x000005fc)

ALL_ILLEGAL

Added in API level 1
int ALL_ILLEGAL

  • Deny all special characters.
  • Deny script URLs.

常量值:0(0x00000000)

ALL_OK

Added in API level 1
int ALL_OK

所有字段设置为OK的掩码

常量值:2047(0x000007ff)

ALL_WHITESPACE_OK

Added in API level 1
int ALL_WHITESPACE_OK

具有常规空间和其他空白的掩码可以

常量值:3(0x00000003)

AMP_AND_SPACE_LEGAL

Added in API level 1
int AMP_AND_SPACE_LEGAL

  • Allow ampersand.
  • Allow space.
  • Deny script URLs.

常量值:129(0x00000081)

AMP_LEGAL

Added in API level 1
int AMP_LEGAL

  • Allow ampersand.
  • Deny script URLs.

常量值:128(0x00000080)

AMP_OK

Added in API level 1
int AMP_OK

允许&符号('&')

常量值:128(0x00000080)

DQUOTE_OK

Added in API level 1
int DQUOTE_OK

允许双引号字符。 ( '“')

常量值:8(0x00000008)

GT_OK

Added in API level 1
int GT_OK

允许大于号的字符。 ( '>')

常量值:64(0x00000040)

LT_OK

Added in API level 1
int LT_OK

允许少于字符。 ( '<')

常量值:32(0x00000020)

NON_7_BIT_ASCII_OK

Added in API level 1
int NON_7_BIT_ASCII_OK

允许字符代码为128到255的字符。

常量值:4(0x00000004)

NUL_OK

Added in API level 1
int NUL_OK

允许nul个字符('\ 0')

常量值:512(0x00000200)

OTHER_WHITESPACE_OK

Added in API level 1
int OTHER_WHITESPACE_OK

允许空格以外的空格字符。 其他空白字符是'\ t''\ f''\ n''\ r'和'\ 0x000b'(垂直制表符)

常量值:2(0x00000002)

PCT_OK

Added in API level 1
int PCT_OK

允许百分号符号('%')

常量值:256(0x00000100)

SCRIPT_URL_OK

Added in API level 1
int SCRIPT_URL_OK

允许文本以脚本URL开头,如“javascript:”或“vbscript:”

常量值:1024(0x00000400)

SPACE_LEGAL

Added in API level 1
int SPACE_LEGAL

  • Allow space.
  • Deny script URLs.

常数值:1(0x00000001)

SPACE_OK

Added in API level 1
int SPACE_OK

允许空格('')字符。

常数值:1(0x00000001)

SQUOTE_OK

Added in API level 1
int SQUOTE_OK

允许单引号字符。 ('\')

常量值:16(0x00000010)

URL_AND_SPACE_LEGAL

Added in API level 1
int URL_AND_SPACE_LEGAL

  • Allow characters used by encoded URLs.
  • Allow spaces.
  • Deny script URLs.

常量值:405(0x00000195)

URL_LEGAL

Added in API level 1
int URL_LEGAL

  • Allow characters used by encoded URLs.
  • Deny script URLs.

常量值:404(0x00000194)

Public constructors

UrlQuerySanitizer.IllegalCharacterValueSanitizer

Added in API level 1
UrlQuerySanitizer.IllegalCharacterValueSanitizer (int flags)

构建一种消毒剂。 这些参数设置了杀菌剂的行为。

Parameters
flags int: some combination of the XXX_OK flags.

Public methods

sanitize

Added in API level 1
String sanitize (String value)

净化价值。

  1. If script URLs are not OK, the will be removed.
  2. 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.)
  3. Illegal characters will be replaced with either ' ' or '_', depending on whether a space is itself a legal character.

Returns
String the sanitized value

Hooray!