Package org.aoju.bus.core.text.escape
Class NumericUnescaper
java.lang.Object
org.aoju.bus.core.text.translate.CharSequenceTranslator
org.aoju.bus.core.text.escape.NumericUnescaper
Translate XML numeric entities of the form &#[xX]?\d+;? to the specific codepoint.
Note that the semi-colon is optional.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumNumericUnescaper option enum. -
Constructor Summary
ConstructorsConstructorDescriptionNumericUnescaper(NumericUnescaper.OPTION... options) Create a UnicodeUnescaper. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisSet(NumericUnescaper.OPTION option) Whether the passed in option is currently set.inttranslate(CharSequence input, int index, Writer out) 将一组由int索引表示的代码点转换为CharSequence, 转换成另一组代码点 必须返回所使用的代码点数量,Methods inherited from class org.aoju.bus.core.text.translate.CharSequenceTranslator
hex, translate, translate, with
-
Constructor Details
-
NumericUnescaper
Create a UnicodeUnescaper.The constructor takes a list of options, only one type of which is currently available (whether to allow, error or ignore the semi-colon on the end of a numeric entity to being missing).
For example, to support numeric entities without a ';': new NumericUnescaper(NumericUnescaper.OPTION.semiColonOptional) and to throw an IllegalArgumentException when they're missing: new NumericUnescaper(NumericUnescaper.OPTION.errorIfNoSemiColon)
Note that the default behaviour is to ignore them.
- Parameters:
options- to apply to this unescaper
-
-
Method Details
-
isSet
Whether the passed in option is currently set.- Parameters:
option- to check state of- Returns:
- whether the option is set
-
translate
Description copied from class:CharSequenceTranslator将一组由int索引表示的代码点转换为CharSequence, 转换成另一组代码点 必须返回所使用的代码点数量,- Specified by:
translatein classCharSequenceTranslator- Parameters:
input- 正在翻译的CharSequenceindex- int表示当前翻译点out- Writer将文本翻译成- Returns:
- 所使用代码点的int计数
- Throws:
IOException- 当写入器生成IOException时抛出IOException
-