Class ByteBufferInfo
Class for parsing a buffer of bytes
Inherited Members
Namespace: SipLib.Core
Assembly: SipLib.dll
Syntax
public class ByteBufferInfo
Methods
| Edit this page View SourceExtractDelimitedByteArray(byte[], int, byte[], byte[])
Extracts a byte array that is delimited by two byte array patterns
Declaration
public static byte[]? ExtractDelimitedByteArray(byte[] SrcArray, int StartIndex, byte[] FirstPattern, byte[] SecondPattern)
Parameters
Type | Name | Description |
---|---|---|
byte[] | SrcArray | The input source array |
int | StartIndex | The stating index in the source array |
byte[] | FirstPattern | The first byte pattern |
byte[] | SecondPattern | The second byte array |
Returns
Type | Description |
---|---|
byte[] | Returns a new byte array if there is one between the FirstPattern and the SecondPattern or null if the FirstPattern and the SecondPattern are not found |
FindFirstBytePattern(byte[], int, byte[])
Finds the first occurrence of byte array pattern within an array.
Declaration
public static int FindFirstBytePattern(byte[] SrcArray, int StartIndex, byte[] BytePattern)
Parameters
Type | Name | Description |
---|---|---|
byte[] | SrcArray | Array to search in. |
int | StartIndex | Index to start looking at |
byte[] | BytePattern | Array of bytes containing the pattern to search for. |
Returns
Type | Description |
---|---|
int | The index within the search array of the start of the pattern to search for. Returns -1 if the pattern is not found. |
FindLastBytePattern(byte[], int, byte[])
Finds the last occurrence of byte array pattern within an array.
Declaration
public static int FindLastBytePattern(byte[] SrcArray, int LastSrcIndex, byte[] BytePattern)
Parameters
Type | Name | Description |
---|---|---|
byte[] | SrcArray | Array to search in. |
int | LastSrcIndex | Last index in the source array to include in the search range |
byte[] | BytePattern | Array of bytes containing the pattern to search for. |
Returns
Type | Description |
---|---|
int | The index within the search array of the start of the pattern to search for. Returns -1 if the pattern is not found. |
GetStringPosition(byte[], int, int, string, string?)
Searches a binary 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 |
---|---|---|
byte[] | buffer | The byte array to search for an instance of the specified string. |
int | startPosition | The position in the array that the search should be started from. |
int | endPosition | An index that if reached indicates the search should be halted. |
string | find | The string that is being searched for. |
string | end | If the end string is found the search is halted and a negative result returned. |
Returns
Type | Description |
---|---|
int | The start position in the buffer of the requested string or -1 if not found. |
HasString(byte[], int, int, string, string)
Tests to see if a binary array contains a string.
Declaration
public static bool HasString(byte[] buffer, int startPosition, int endPosition, string find, string end)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buffer | The byte array to search for an instance of the specified string. |
int | startPosition | The position in the array that the search should be started from. |
int | endPosition | An index that if reached indicates the search should be halted. |
string | find | The string that is being searched for. |
string | end | If this string is not null and is found before the find string is found, then false is returned. |
Returns
Type | Description |
---|---|
bool | Returns true if the array contains the specified string or false if it does not |