Class ByteTool
- Namespace
- Lextm.SharpSnmpLib
- Assembly
- SharpSnmpLib.dll
Helper utility that performs data conversions from/to bytes.
public static class ByteTool
- Inheritance
-
ByteTool
- Inherited Members
Methods
Convert(byte[])
Converts bytes to a byte string.
public static string Convert(byte[] buffer)
Parameters
buffer
byte[]The bytes.
Returns
- string
The formatted string.
Remarks
new byte[] { 0x80, 0x00 }
is converted to "80 00"
.
Convert(IEnumerable<char>)
Converts the byte string to bytes.
public static byte[] Convert(IEnumerable<char> description)
Parameters
description
IEnumerable<char>The HEX string.
Returns
- byte[]
The converted bytes.
Remarks
"80 00"
is converted to new byte[] { 0x80, 0x00 }
.
ConvertDecimal(string)
Converts decimal string to bytes.
public static byte[] ConvertDecimal(string description)
Parameters
description
stringThe decimal string.
Returns
- byte[]
The converted bytes.
Remarks
" 16 18 "
is converted to new byte[] { 0x10, 0x12 }
.
PackMessage(byte[]?, VersionCode, ISegment, ISegment, ISnmpData)
Packs parts into a single message body.
public static Sequence PackMessage(byte[]? length, VersionCode version, ISegment header, ISegment parameters, ISnmpData data)
Parameters
length
byte[]Message length.
version
VersionCodeMessage version.
header
ISegmentHeader.
parameters
ISegmentSecurity parameters.
data
ISnmpDataScope data.