Class BufferUtils
Inheritance
System.Object
BufferUtils
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: SIPSorcery.Sys
Assembly: SIPSorcery.dll
Syntax
public class BufferUtils
Methods
| Improve this Doc View SourceGetStringPosition(Byte[], Int32, Int32, String, String)
Searches a buffer for a string up until a specified end string.
Declaration
public static int GetStringPosition(byte[] buffer, int startPosition, int endPosition, string find, string end)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The byte array to search for an instance of the specified string. |
System.Int32 | startPosition | The position in the array that the search should be started from. |
System.Int32 | endPosition | An index that if reached indicates the search should be halted. |
System.String | find | The string that is being searched for. |
System.String | end | If the end string is found the search is halted and a negative result returned. |
Returns
Type | Description |
---|---|
System.Int32 | The start position in the buffer of the requested string or -1 if not found. |
HasString(Byte[], Int32, Int32, String, String)
Declaration
public static bool HasString(byte[] buffer, int startPosition, int endPosition, string find, string end)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | |
System.Int32 | startPosition | |
System.Int32 | endPosition | |
System.String | find | |
System.String | end |
Returns
Type | Description |
---|---|
System.Boolean |
HexStr(Byte[])
Declaration
public static string HexStr(byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer |
Returns
Type | Description |
---|---|
System.String |
IndexOf(Byte[], Byte[], Int32)
Finds the index of a specific byte pattern in a byte array.
Declaration
public static int IndexOf(byte[] buffer, byte[] pattern, int startIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The byte array to search in. |
System.Byte[] | pattern | The byte pattern to search for. |
System.Int32 | startIndex | The index in the buffer to start the search from. |
Returns
Type | Description |
---|---|
System.Int32 | The index of the first occurrence of the pattern, or -1 if not found. |
ParseHexStr(String)
Declaration
public static byte[] ParseHexStr(string hex)
Parameters
Type | Name | Description |
---|---|---|
System.String | hex |
Returns
Type | Description |
---|---|
System.Byte[] |