Difference between revisions of "Core.Terms.EncodeInteger"
Jump to navigation
Jump to search
(Created page with "Category:Core == Classification == {{ClassificationActivity | EncodeInteger | Returns a ByteFieldwhich contains the encoded value of the original Integer argument. | Ter...") |
|||
Line 3: | Line 3: | ||
{{ClassificationActivity | EncodeInteger | Returns a ByteFieldwhich contains the encoded value of the original Integer argument. | [[Term]] | [[Core|OTX Core library]] | [[Integer conversion terms]] | [[OutOfBoundsException]] | - }} | {{ClassificationActivity | EncodeInteger | Returns a ByteFieldwhich contains the encoded value of the original Integer argument. | [[Term]] | [[Core|OTX Core library]] | [[Integer conversion terms]] | [[OutOfBoundsException]] | - }} | ||
− | == | + | == OTL Syntax == |
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
− | + | ByteFieldTerm = Conversion.EncodeInteger(EncodingType, Endianness, IntegerTerm); | |
</syntaxhighlight> | </syntaxhighlight> | ||
Line 25: | Line 25: | ||
== Examples == | == Examples == | ||
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
− | ByteField result = EncodeInteger(@EncodingType: | + | ByteField result; |
+ | result = EncodeInteger(@EncodingType:TWOSCOMPLEMENT, @EncodingSize:16BIT, @Endianness:LITTLEENDIAN, -256); | ||
//Returns the result = 00 FF | //Returns the result = 00 FF | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 02:53, 4 February 2015
Contents
Classification
Name | EncodeInteger |
Short Description | Returns a ByteFieldwhich contains the encoded value of the original Integer argument. |
Class | Term |
Extension | OTX Core library |
Group | Integer conversion terms |
Exceptions | OutOfBoundsException |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
ByteFieldTerm = Conversion.EncodeInteger(EncodingType, Endianness, IntegerTerm);
Description
EncodeInteger term returns a ByteField which contains the encoded value of the original Integer argument. For the encoding, n-bit unsigned, n-bit signed-binary or n-bit two's complement representation of the integer can be chosen, where be chosen out of 8, 16, 32 and 64bit. The term also provides control over the byte order which be used for encoding.
Return Value
The Term returns the value, see table below.
![]()
In OTX, Terms are categorized according to its return data type!
Data Type | Description |
ByteField | The decoded ByteField value of the Integer argument |
Properties
Name | Data Type | Class | Default | Cardinality | Description |
EncodingType | EncodingType | Value | @EncodingType:64-BIT | [1] | Specifies how the Integer value be encoded. EncodingType = {UNSIGNED|SIGNED-BINARY|TWOS-COMPLEMENT} |
EncodingSize | EncodingSize | Value | @EncodingSize:64-BIT | [1] | Specifies how many bits shall be used for the encoding. EncodingSize = {8-BIT|16-BIT|32-BIT|64-BIT} |
ByteOrder | Endianness | Value | @Endianness:LITTLE-ENDIAN | [1] | Specifies the byte order which shall be used when writing the encoded Integervalue into the resulting ByteField. Endianness = {LITTE-ENDIAN|MIXED-ENDIAN|BIG-ENDIAN}. LITTLE-ENDIAN is the default value. |
Integer | Integer | Term | - | [1] | Represents the Integer value which be converted to ByteField. |
Examples
ByteField result;
result = EncodeInteger(@EncodingType:TWOSCOMPLEMENT, @EncodingSize:16BIT, @Endianness:LITTLEENDIAN, -256);
//Returns the result = 00 FF