CharacterTranslationException class: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
<!-- CharacterTranslationException class --> | <!-- CharacterTranslationException class --> | ||
__NOTOC__ | |||
Various methods throw a <var>CharacterTranslationException</var> exception when they encounter character translation problems. To avert request cancellation, you can <var>[[catch]]</var> such an exception, optionally catching to an object of this class. | Various methods throw a <var>CharacterTranslationException</var> exception when they encounter character translation problems. To avert request cancellation, you can <var>[[catch]]</var> such an exception, optionally catching to an object of this class. | ||
Line 30: | Line 31: | ||
<h2>CharacterPosition property</h2> | <h2>CharacterPosition property</h2> | ||
{{Template:CharacterTranslationException:CharacterPosition subtitle}} | |||
<h4>Syntax</h4> | |||
{{Template:CharacterTranslationException:CharacterPosition syntax}} | |||
<h4>Syntax terms</h4> | |||
<table class="syntaxTable"> | |||
<tr><th>%number</th> | |||
<td>The position of the character at which the exception was thrown. | |||
</td></tr> | |||
<tr><th>characterTranslationException</th> | |||
<td>A reference to an instance of a <var>[[CharacterTranslationException_class|CharacterTranslationException]]</var> object. | |||
</td></tr></table> | |||
<h4>Usage notes</h4> | |||
<ul> | |||
<li>The number of bytes that constitute a character depends on the type of string | |||
that causes the exception: | |||
<ul> | |||
<li>If EBCDIC, one byte corresponds to one character. | |||
<li>If [[Unicode]], two bytes correspond to one character. | |||
<li>If UTF-16, two bytes correspond to one character. | |||
<li>If UTF-8, the relationship between bytes and characters is | |||
variable, depending on the code points. | |||
</ul></ul> | |||
<h2>Description property</h2> | <h2>Description property</h2> | ||
{{Template:CharacterTranslationException:Description subtitle}} | |||
<h4>Syntax</h4> | |||
{{Template:CharacterTranslationException:Description syntax}} | |||
<h4>Syntax terms</h4> | |||
<table class="syntaxTable"> | |||
<tr><th>%string</th> | |||
<td>A string to receive the description of the exception. | |||
</td></tr> | |||
<tr><th>characterTranslationException</th> | |||
<td>A reference to an instance of a <var>[[CharacterTranslationException_class|CharacterTranslationException]]</var> object. | |||
</td></tr></table> | |||
<h2>HexValueproperty</h2> | <h2>HexValueproperty</h2> | ||
{{Template:CharacterTranslationException:HexValue subtitle}} | |||
<h4>Syntax</h4> | |||
{{Template:CharacterTranslationException:HexValue syntax}} | |||
<h4>Syntax terms</h4> | |||
<table class="syntaxTable"> | |||
<tr><th>%string</th> | |||
<td>A string to receive the hexadecimal value of the bytes that caused the exception to be thrown. | |||
</td></tr> | |||
<tr><th>characterTranslationException</th> | |||
<td>A reference to an instance of a <var>[[CharacterTranslationException_class|CharacterTranslationException]]</var> object. | |||
</td></tr></table> | |||
<h2>New constructor</h2> | <h2>New constructor</h2> | ||
{{Template:CharacterTranslationException:New subtitle}} | |||
Each argument to <var>New</var> sets the value of the corresponding property of the newly constructed <var>CharacterTranslationException</var> object. | |||
<h4>Syntax</h4> | |||
{{Template:CharacterTranslationException:New syntax}} | |||
<h4>Syntax terms</h4> | |||
<table class="syntaxTable"> | |||
<tr><th>%characterTranslationException</th> | |||
<td>A reference to the newly created instance of a <var>[[CharacterTranslationException_class|CharacterTranslationException]]</var> object. | |||
</td></tr> | |||
<tr><th><var>Reason</var></th> | |||
<td><var>Reason</var> is a <b><i>non-</i></b>optional, [[Methods#Named parameters|name required]] parameter specifying the value to be assigned to the exception object's <var>[[Reason (CharacterTranslationException property)|Reason]]</var> property. | |||
<p>As described for the <var>Reason]]</var> property, the <var>translationExceptionReason</var> enumeration values are <var>InvalidEncoding</var>, <var>InvalidCharacterReference</var>, and <var>UntranslatableCharacter</var>.</p></td></tr> | |||
<tr><th><var>HexValue</var></th> | |||
<td>This name required parameter specifies the string value (<var class="term">string</var>) to be assigned to the object's <var>[[HexValue_(CharacterTranslationException_property)|HexValue]]</var> property. | |||
</td></tr> | |||
<tr><th><var>BytePosition</var></th> | |||
<td>This name required parameter specifies the numeric value (<var class="term">number</var>) to be assigned to the object's <var>[[BytePosition_(CharacterTranslationException_property)|BytePosition]]</var> property. | |||
</td></tr> | |||
<tr><th><var>CharacterPosition</var></th> | |||
<td>This name required parameter specifies the numeric value (<var class="term">number</var>) to be assigned to the object's <var>[[CharacterPosition_(CharacterTranslationException_property)|CharacterPosition]]</var> property. | |||
</td></tr> | |||
<tr><th><var>Description</var></th> | |||
<td>This name required parameter specifies the string value (<var class="term">string</var>) to be assigned to the object's <var>[[Description_(CharacterTranslationException_property)|Description]]</var> property. | |||
</td></tr> | |||
</table> | |||
<h2>Reason property</h2> | <h2>Reason property</h2> | ||
[[Category:System exception classes]] | [[Category:System exception classes]] |
Revision as of 23:02, 9 May 2011
Various methods throw a CharacterTranslationException exception when they encounter character translation problems. To avert request cancellation, you can catch such an exception, optionally catching to an object of this class.
This class is available as of Sirius Mods Version 7.3.
The CharacterTranslationException methods
The following are the available CharacterTranslationException class methods.
Method | Description |
---|---|
BytePosition | Position of byte at which the exception was thrown |
CharacterPosition | Position of character at which the exception was thrown |
Description | Brief description of the exception |
HexValue | Hexadecimal value of bytes causing the exception |
New | Create a new CharacterTranslationException object |
Reason | Enumerated cause of the exception |
The methods in the class are described in the subsections that follow. In addition:
- "Notation conventions for methods" has information about the conventions followed.
- "CharacterTranslationException methods syntax" is a single page that contains the syntax diagrams of all the methods in the class.
BytePosition property
Position of byte at which the exception was thrown (CharacterTranslationException class)
Syntax
%number = characterTranslationException:BytePosition
Syntax terms
%number | The position of the byte at which the exception was thrown. |
---|---|
characterTranslationException | A reference to an instance of a CharacterTranslationException object. |
CharacterPosition property
Position of character at which the exception was thrown (CharacterTranslationException class)
Syntax
%number = characterTranslationException:CharacterPosition
Syntax terms
%number | The position of the character at which the exception was thrown. |
---|---|
characterTranslationException | A reference to an instance of a CharacterTranslationException object. |
Usage notes
- The number of bytes that constitute a character depends on the type of string
that causes the exception:
- If EBCDIC, one byte corresponds to one character.
- If Unicode, two bytes correspond to one character.
- If UTF-16, two bytes correspond to one character.
- If UTF-8, the relationship between bytes and characters is variable, depending on the code points.
Description property
Brief description of the exception (CharacterTranslationException class)
Syntax
%string = characterTranslationException:Description
Syntax terms
%string | A string to receive the description of the exception. |
---|---|
characterTranslationException | A reference to an instance of a CharacterTranslationException object. |
HexValueproperty
Hexadecimal value of bytes causing the exception (CharacterTranslationException class)
Syntax
%string = characterTranslationException:HexValue
Syntax terms
%string | A string to receive the hexadecimal value of the bytes that caused the exception to be thrown. |
---|---|
characterTranslationException | A reference to an instance of a CharacterTranslationException object. |
New constructor
Create a new CharacterTranslationException object (CharacterTranslationException class) Each argument to New sets the value of the corresponding property of the newly constructed CharacterTranslationException object.
Syntax
%characterTranslationException = [%(CharacterTranslationException):]New( Reason= translationExceptionReason, - [HexValue= string], - [BytePosition= number], - [CharacterPosition= number], - [Description= string])
Syntax terms
%characterTranslationException | A reference to the newly created instance of a CharacterTranslationException object. |
---|---|
Reason | Reason is a non-optional, name required parameter specifying the value to be assigned to the exception object's Reason property.
As described for the Reason]] property, the translationExceptionReason enumeration values are InvalidEncoding, InvalidCharacterReference, and UntranslatableCharacter. |
HexValue | This name required parameter specifies the string value (string) to be assigned to the object's HexValue property. |
BytePosition | This name required parameter specifies the numeric value (number) to be assigned to the object's BytePosition property. |
CharacterPosition | This name required parameter specifies the numeric value (number) to be assigned to the object's CharacterPosition property. |
Description | This name required parameter specifies the string value (string) to be assigned to the object's Description property. |