BinHelpers

Overview

The BinHelpers static class contains methods used to aid in byte and streaming operations.

Location

 

AnsiStringFromBuffer

Converts the provided byte array to a 8 bit ANSI string using the current ANSI codepage.

 

class method AnsiStringFromBuffer(buffer: array of Byte): String

 

static String AnsiStringFromBuffer(Byte[] buffer)

 

Shared Function AnsiStringFromBuffer(buffer As Byte()) As String

Parameters:

  • buffer: Byte buffer containing ANSI string

AnsiStringToBuffer

Converts provided string to a Byte buffer.

 

class method AnsiStringToBuffer(value: String): array of Byte

 

static Byte[] AnsiStringToBuffer(String value)

 

Shared Function AnsiStringToBuffer(value As String) As Byte()

Parameters:

  • value: String to convert

CompareBuffer

Compares conents of two byte arrays. Returns true if the content is identical.

 

class method CompareBuffer(left: array of Byte; right: array of Byte): Boolean

 

static Boolean CompareBuffer(Byte[] left, Byte[] right)

 

Shared Function CompareBuffer(left As Byte(), right As Byte()) As Boolean

Parameters:

  • left: Byte array to compare
  • right: Byte array to compare

CopyBuffer

Copies the given source buffer byte array to the given destination buffer byte array with respect to the provided offsets and data length.

 

class method CopyBuffer(source: array of Byte; destination: array of Byte; sourceOffSet: Int32; destinationOffset: Int32; length: Int32)

 

static void CopyBuffer(Byte[] source, Byte[] destination, Int32 sourceOffSet, Int32 destinationOffset, Int32 length)

 

Shared Sub CopyBuffer(source As Byte(), destination As Byte(), sourceOffSet As Int32, destinationOffset As Int32, length As Int32)

Parameters:

  • source: Source byte array buffer
  • destination: Destination byte array buffer
  • sourceOffSet: Source buffer offset
  • destinationOffset: Destination buffer offset
  • length: Amount of data to copy

CurrencyFromBuffer

Converts provided byte array to a Decimal value.

 

class method CurrencyFromBuffer(buffer: array of Byte): Decimal

 

static Decimal CurrencyFromBuffer(Byte[] buffer)

 

Shared Function CurrencyFromBuffer(buffer As Byte()) As Decimal

Parameters:

  • buffer: Byte buffer containing encoded Decimal value

CurrencyToBuffer

Converts the provided Decimal value to a byte array.

 

class method CurrencyToBuffer(value: Decimal): array of Byte

 

static Byte[] CurrencyToBuffer(Decimal value)

 

Shared Function CurrencyToBuffer(value As Decimal) As Byte()

Parameters:

  • value: Decimal value to convert

DateTimeToDelphiDate

Converts a DateTime value to a Double value where the value represents the number of days that have passed since December 30th 1899 and the fractional part of the double represents a fraction of a 24 hour day.

 

class method DateTimeToDelphiDate(date: DateTime): Double

 

static Double DateTimeToDelphiDate(DateTime date)

 

Shared Function DateTimeToDelphiDate(date As DateTime) As Double

Parameters:

  • date: DateTime value to convert

DefaultStringEncoding

 

class property DefaultStringEncoding: Encoding read;

 

class Encoding DefaultStringEncoding { get; }

 

Shared ReadOnly Property DefaultStringEncoding() As Encoding

DelphiDateToDateTime

Converts a Double value to a DateTime value where the value of the given double represents the number of days that have passed since December 30th 1899 and the fractional part of the double represents a fraction of a 24 hour day.

 

class method DelphiDateToDateTime(date: Double): DateTime

 

static DateTime DelphiDateToDateTime(Double date)

 

Shared Function DelphiDateToDateTime(date As Double) As DateTime

Parameters:

  • date: Double value representing encoded date

FLAG_OBJECT_ASSIGNED

Flag used to mark unassigned objects.

The value of this constant is 0

 

const FLAG_OBJECT_ASSIGNED: Byte = 1;

 

const Byte FLAG_OBJECT_ASSIGNED = 1

 

Dim FLAG_OBJECT_ASSIGNED As Byte = 1

FLAG_OBJECT_UNASSIGNED

Flag used to mark assigned objects.

The value of this constant is 1

 

const FLAG_OBJECT_UNASSIGNED: Byte = 0;

 

const Byte FLAG_OBJECT_UNASSIGNED = 0

 

Dim FLAG_OBJECT_UNASSIGNED As Byte = 0

HexStringFromBuffer

 

class method HexStringFromBuffer(buffer: array of Byte): String

 

static String HexStringFromBuffer(Byte[] buffer)

 

Shared Function HexStringFromBuffer(buffer As Byte()) As String

Parameters:

  • buffer:

Int16FromBuffer

Converts the given byte array to an Int16 value.

 

class method Int16FromBuffer(buffer: array of Byte): Int32

 

static Int32 Int16FromBuffer(Byte[] buffer)

 

Shared Function Int16FromBuffer(buffer As Byte()) As Int32

Parameters:

  • buffer: Encoded integer value

Int16ToBuffer

Converts the provided Int16 value to a byte array.

 

class method Int16ToBuffer(value: Int32): array of Byte

 

static Byte[] Int16ToBuffer(Int32 value)

 

Shared Function Int16ToBuffer(value As Int32) As Byte()

Parameters:

  • value: Int16 value to convert

Int32FromBigEndianBuffer

Converts the provided byte array to an Int32 value.

 

class method Int32FromBigEndianBuffer(buffer: array of Byte): Int32

 

static Int32 Int32FromBigEndianBuffer(Byte[] buffer)

 

Shared Function Int32FromBigEndianBuffer(buffer As Byte()) As Int32

Parameters:

  • buffer: Byte array containing encoded Int32 value

Int32FromBuffer (array of Byte): Int32

Converts the given byte array to an Int32 value.

 

class method Int32FromBuffer(buffer: array of Byte): Int32

 

static Int32 Int32FromBuffer(Byte[] buffer)

 

Shared Function Int32FromBuffer(buffer As Byte()) As Int32

Parameters:

  • buffer: Byte array containing encoded Int32 value

Int32FromBuffer (array of Byte, Int32): Int32

Converts the given byte array to an Int32 value.

 

class method Int32FromBuffer(buffer: array of Byte; offset: Int32): Int32

 

static Int32 Int32FromBuffer(Byte[] buffer, Int32 offset)

 

Shared Function Int32FromBuffer(buffer As Byte(), offset As Int32) As Int32

Parameters:

  • buffer: Byte array containing encoded Int32 value
  • offset: Buffer offset

Int32ToBigEndianBuffer

Converts the provided Int32 value to a byte array and puts the resulting data into the provided buffer.

 

class method Int32ToBigEndianBuffer(value: Int32; buffer: array of Byte)

 

static void Int32ToBigEndianBuffer(Int32 value, Byte[] buffer)

 

Shared Sub Int32ToBigEndianBuffer(value As Int32, buffer As Byte())

Parameters:

  • value: Int32 value to convert
  • buffer: Byte buffer

Int32ToBuffer (Int32): array of Byte

Converts the provided Int32 value to a byte array.

 

class method Int32ToBuffer(value: Int32): array of Byte

 

static Byte[] Int32ToBuffer(Int32 value)

 

Shared Function Int32ToBuffer(value As Int32) As Byte()

Parameters:

  • value: Int32 value to convert

Int32ToBuffer (Int32, array of Byte)

Converts the provided Int32 value to a byte array and puts the resulting data into the provided buffer.

 

class method Int32ToBuffer(value: Int32; buffer: array of Byte)

 

static void Int32ToBuffer(Int32 value, Byte[] buffer)

 

Shared Sub Int32ToBuffer(value As Int32, buffer As Byte())

Parameters:

  • value: Int32 value to convert
  • buffer: Byte buffer

Int64FromBuffer

Converts the given byte array to an Int64.

 

class method Int64FromBuffer(buffer: array of Byte): Int64

 

static Int64 Int64FromBuffer(Byte[] buffer)

 

Shared Function Int64FromBuffer(buffer As Byte()) As Int64

Parameters:

  • buffer: Byte array containing encoded Int64 value

Int64ToBuffer

Converts the given Int64 value to a byte array.

 

class method Int64ToBuffer(value: Int64): array of Byte

 

static Byte[] Int64ToBuffer(Int64 value)

 

Shared Function Int64ToBuffer(value As Int64) As Byte()

Parameters:

  • value: Int64 value to convert

SIZE_BYTE

Size of Byte type in bytes.

Value of this constant is 1

 

const SIZE_BYTE: Int32 = 1;

 

const Int32 SIZE_BYTE = 1

 

Dim SIZE_BYTE As Int32 = 1

SIZE_CURRENCY

Size of Decimal type in bytes.

Value of this constant is 8

 

const SIZE_CURRENCY: Int32 = 8;

 

const Int32 SIZE_CURRENCY = 8

 

Dim SIZE_CURRENCY As Int32 = 8

SIZE_DOUBLE

Size of Double type in bytes.

Value of this constant is 8

 

const SIZE_DOUBLE: Int32 = 8;

 

const Int32 SIZE_DOUBLE = 8

 

Dim SIZE_DOUBLE As Int32 = 8

SIZE_GUID

Size of Guid type in bytes.

Value of this constant is 16

 

const SIZE_GUID: Int32 = 16;

 

const Int32 SIZE_GUID = 16

 

Dim SIZE_GUID As Int32 = 16

SIZE_INT16

Size of Int16 type in bytes.

Value of this constant is 2

 

const SIZE_INT16: Int32 = 2;

 

const Int32 SIZE_INT16 = 2

 

Dim SIZE_INT16 As Int32 = 2

SIZE_INT32

Size of Int32 type in bytes.

Value of this constant is 4

 

const SIZE_INT32: Int32 = 4;

 

const Int32 SIZE_INT32 = 4

 

Dim SIZE_INT32 As Int32 = 4

SIZE_INT64

Size of Int64 type in bytes.

Value of this constant is 8

 

const SIZE_INT64: Int32 = 8;

 

const Int32 SIZE_INT64 = 8

 

Dim SIZE_INT64 As Int32 = 8

StringFromBuffer

 

class method StringFromBuffer(buffer: array of Byte; encoding: Encoding): String

 

static String StringFromBuffer(Byte[] buffer, Encoding encoding)

 

Shared Function StringFromBuffer(buffer As Byte(), encoding As Encoding) As String

Parameters:

  • buffer:
  • encoding:

StringToBuffer

 

class method StringToBuffer(value: String; encoding: Encoding): array of Byte

 

static Byte[] StringToBuffer(String value, Encoding encoding)

 

Shared Function StringToBuffer(value As String, encoding As Encoding) As Byte()

Parameters:

  • value:
  • encoding:

Utf8StringFromBuffer

Converts the provided byte array to a UTF-8 string.

 

class method Utf8StringFromBuffer(buffer: array of Byte): String

 

static String Utf8StringFromBuffer(Byte[] buffer)

 

Shared Function Utf8StringFromBuffer(buffer As Byte()) As String

Parameters:

  • buffer: Byte buffer containing UTF8 string

Utf8StringToBuffer

Converts provided string to a Byte buffer.

 

class method Utf8StringToBuffer(value: String): array of Byte

 

static Byte[] Utf8StringToBuffer(String value)

 

Shared Function Utf8StringToBuffer(value As String) As Byte()

Parameters:

  • value: String to convert

WideStringFromBuffer

Converts the provided byte array to a UTF-16 string.

 

class method WideStringFromBuffer(buffer: array of Byte): String

 

static String WideStringFromBuffer(Byte[] buffer)

 

Shared Function WideStringFromBuffer(buffer As Byte()) As String

Parameters:

  • buffer: Byte buffer containing Unicode string

WideStringToBuffer

Converts provided string to a Byte buffer.

 

class method WideStringToBuffer(value: String): array of Byte

 

static Byte[] WideStringToBuffer(String value)

 

Shared Function WideStringToBuffer(value As String) As Byte()

Parameters:

  • value: String to convert

 

FLAG_OBJECT_ASSIGNED

Flag used to mark unassigned objects.

The value of this constant is 0

 

const FLAG_OBJECT_ASSIGNED: Byte = 1;

 

const Byte FLAG_OBJECT_ASSIGNED = 1

 

Dim FLAG_OBJECT_ASSIGNED As Byte = 1

FLAG_OBJECT_UNASSIGNED

Flag used to mark assigned objects.

The value of this constant is 1

 

const FLAG_OBJECT_UNASSIGNED: Byte = 0;

 

const Byte FLAG_OBJECT_UNASSIGNED = 0

 

Dim FLAG_OBJECT_UNASSIGNED As Byte = 0

SIZE_BYTE

Size of Byte type in bytes.

Value of this constant is 1

 

const SIZE_BYTE: Int32 = 1;

 

const Int32 SIZE_BYTE = 1

 

Dim SIZE_BYTE As Int32 = 1

SIZE_CURRENCY

Size of Decimal type in bytes.

Value of this constant is 8

 

const SIZE_CURRENCY: Int32 = 8;

 

const Int32 SIZE_CURRENCY = 8

 

Dim SIZE_CURRENCY As Int32 = 8

SIZE_DOUBLE

Size of Double type in bytes.

Value of this constant is 8

 

const SIZE_DOUBLE: Int32 = 8;

 

const Int32 SIZE_DOUBLE = 8

 

Dim SIZE_DOUBLE As Int32 = 8

SIZE_GUID

Size of Guid type in bytes.

Value of this constant is 16

 

const SIZE_GUID: Int32 = 16;

 

const Int32 SIZE_GUID = 16

 

Dim SIZE_GUID As Int32 = 16

SIZE_INT16

Size of Int16 type in bytes.

Value of this constant is 2

 

const SIZE_INT16: Int32 = 2;

 

const Int32 SIZE_INT16 = 2

 

Dim SIZE_INT16 As Int32 = 2

SIZE_INT32

Size of Int32 type in bytes.

Value of this constant is 4

 

const SIZE_INT32: Int32 = 4;

 

const Int32 SIZE_INT32 = 4

 

Dim SIZE_INT32 As Int32 = 4

SIZE_INT64

Size of Int64 type in bytes.

Value of this constant is 8

 

const SIZE_INT64: Int32 = 8;

 

const Int32 SIZE_INT64 = 8

 

Dim SIZE_INT64 As Int32 = 8

 

DefaultStringEncoding

 

class property DefaultStringEncoding: Encoding read;

 

class Encoding DefaultStringEncoding { get; }

 

Shared ReadOnly Property DefaultStringEncoding() As Encoding

 

AnsiStringFromBuffer

Converts the provided byte array to a 8 bit ANSI string using the current ANSI codepage.

 

class method AnsiStringFromBuffer(buffer: array of Byte): String

 

static String AnsiStringFromBuffer(Byte[] buffer)

 

Shared Function AnsiStringFromBuffer(buffer As Byte()) As String

Parameters:

  • buffer: Byte buffer containing ANSI string

AnsiStringToBuffer

Converts provided string to a Byte buffer.

 

class method AnsiStringToBuffer(value: String): array of Byte

 

static Byte[] AnsiStringToBuffer(String value)

 

Shared Function AnsiStringToBuffer(value As String) As Byte()

Parameters:

  • value: String to convert

CompareBuffer

Compares conents of two byte arrays. Returns true if the content is identical.

 

class method CompareBuffer(left: array of Byte; right: array of Byte): Boolean

 

static Boolean CompareBuffer(Byte[] left, Byte[] right)

 

Shared Function CompareBuffer(left As Byte(), right As Byte()) As Boolean

Parameters:

  • left: Byte array to compare
  • right: Byte array to compare

CopyBuffer

Copies the given source buffer byte array to the given destination buffer byte array with respect to the provided offsets and data length.

 

class method CopyBuffer(source: array of Byte; destination: array of Byte; sourceOffSet: Int32; destinationOffset: Int32; length: Int32)

 

static void CopyBuffer(Byte[] source, Byte[] destination, Int32 sourceOffSet, Int32 destinationOffset, Int32 length)

 

Shared Sub CopyBuffer(source As Byte(), destination As Byte(), sourceOffSet As Int32, destinationOffset As Int32, length As Int32)

Parameters:

  • source: Source byte array buffer
  • destination: Destination byte array buffer
  • sourceOffSet: Source buffer offset
  • destinationOffset: Destination buffer offset
  • length: Amount of data to copy

CurrencyFromBuffer

Converts provided byte array to a Decimal value.

 

class method CurrencyFromBuffer(buffer: array of Byte): Decimal

 

static Decimal CurrencyFromBuffer(Byte[] buffer)

 

Shared Function CurrencyFromBuffer(buffer As Byte()) As Decimal

Parameters:

  • buffer: Byte buffer containing encoded Decimal value

CurrencyToBuffer

Converts the provided Decimal value to a byte array.

 

class method CurrencyToBuffer(value: Decimal): array of Byte

 

static Byte[] CurrencyToBuffer(Decimal value)

 

Shared Function CurrencyToBuffer(value As Decimal) As Byte()

Parameters:

  • value: Decimal value to convert

DateTimeToDelphiDate

Converts a DateTime value to a Double value where the value represents the number of days that have passed since December 30th 1899 and the fractional part of the double represents a fraction of a 24 hour day.

 

class method DateTimeToDelphiDate(date: DateTime): Double

 

static Double DateTimeToDelphiDate(DateTime date)

 

Shared Function DateTimeToDelphiDate(date As DateTime) As Double

Parameters:

  • date: DateTime value to convert

DelphiDateToDateTime

Converts a Double value to a DateTime value where the value of the given double represents the number of days that have passed since December 30th 1899 and the fractional part of the double represents a fraction of a 24 hour day.

 

class method DelphiDateToDateTime(date: Double): DateTime

 

static DateTime DelphiDateToDateTime(Double date)

 

Shared Function DelphiDateToDateTime(date As Double) As DateTime

Parameters:

  • date: Double value representing encoded date

HexStringFromBuffer

 

class method HexStringFromBuffer(buffer: array of Byte): String

 

static String HexStringFromBuffer(Byte[] buffer)

 

Shared Function HexStringFromBuffer(buffer As Byte()) As String

Parameters:

  • buffer:

Int16FromBuffer

Converts the given byte array to an Int16 value.

 

class method Int16FromBuffer(buffer: array of Byte): Int32

 

static Int32 Int16FromBuffer(Byte[] buffer)

 

Shared Function Int16FromBuffer(buffer As Byte()) As Int32

Parameters:

  • buffer: Encoded integer value

Int16ToBuffer

Converts the provided Int16 value to a byte array.

 

class method Int16ToBuffer(value: Int32): array of Byte

 

static Byte[] Int16ToBuffer(Int32 value)

 

Shared Function Int16ToBuffer(value As Int32) As Byte()

Parameters:

  • value: Int16 value to convert

Int32FromBigEndianBuffer

Converts the provided byte array to an Int32 value.

 

class method Int32FromBigEndianBuffer(buffer: array of Byte): Int32

 

static Int32 Int32FromBigEndianBuffer(Byte[] buffer)

 

Shared Function Int32FromBigEndianBuffer(buffer As Byte()) As Int32

Parameters:

  • buffer: Byte array containing encoded Int32 value

Int32FromBuffer (array of Byte): Int32

Converts the given byte array to an Int32 value.

 

class method Int32FromBuffer(buffer: array of Byte): Int32

 

static Int32 Int32FromBuffer(Byte[] buffer)

 

Shared Function Int32FromBuffer(buffer As Byte()) As Int32

Parameters:

  • buffer: Byte array containing encoded Int32 value

Int32FromBuffer (array of Byte, Int32): Int32

Converts the given byte array to an Int32 value.

 

class method Int32FromBuffer(buffer: array of Byte; offset: Int32): Int32

 

static Int32 Int32FromBuffer(Byte[] buffer, Int32 offset)

 

Shared Function Int32FromBuffer(buffer As Byte(), offset As Int32) As Int32

Parameters:

  • buffer: Byte array containing encoded Int32 value
  • offset: Buffer offset

Int32ToBigEndianBuffer

Converts the provided Int32 value to a byte array and puts the resulting data into the provided buffer.

 

class method Int32ToBigEndianBuffer(value: Int32; buffer: array of Byte)

 

static void Int32ToBigEndianBuffer(Int32 value, Byte[] buffer)

 

Shared Sub Int32ToBigEndianBuffer(value As Int32, buffer As Byte())

Parameters:

  • value: Int32 value to convert
  • buffer: Byte buffer

Int32ToBuffer (Int32): array of Byte

Converts the provided Int32 value to a byte array.

 

class method Int32ToBuffer(value: Int32): array of Byte

 

static Byte[] Int32ToBuffer(Int32 value)

 

Shared Function Int32ToBuffer(value As Int32) As Byte()

Parameters:

  • value: Int32 value to convert

Int32ToBuffer (Int32, array of Byte)

Converts the provided Int32 value to a byte array and puts the resulting data into the provided buffer.

 

class method Int32ToBuffer(value: Int32; buffer: array of Byte)

 

static void Int32ToBuffer(Int32 value, Byte[] buffer)

 

Shared Sub Int32ToBuffer(value As Int32, buffer As Byte())

Parameters:

  • value: Int32 value to convert
  • buffer: Byte buffer

Int64FromBuffer

Converts the given byte array to an Int64.

 

class method Int64FromBuffer(buffer: array of Byte): Int64

 

static Int64 Int64FromBuffer(Byte[] buffer)

 

Shared Function Int64FromBuffer(buffer As Byte()) As Int64

Parameters:

  • buffer: Byte array containing encoded Int64 value

Int64ToBuffer

Converts the given Int64 value to a byte array.

 

class method Int64ToBuffer(value: Int64): array of Byte

 

static Byte[] Int64ToBuffer(Int64 value)

 

Shared Function Int64ToBuffer(value As Int64) As Byte()

Parameters:

  • value: Int64 value to convert

StringFromBuffer

 

class method StringFromBuffer(buffer: array of Byte; encoding: Encoding): String

 

static String StringFromBuffer(Byte[] buffer, Encoding encoding)

 

Shared Function StringFromBuffer(buffer As Byte(), encoding As Encoding) As String

Parameters:

  • buffer:
  • encoding:

StringToBuffer

 

class method StringToBuffer(value: String; encoding: Encoding): array of Byte

 

static Byte[] StringToBuffer(String value, Encoding encoding)

 

Shared Function StringToBuffer(value As String, encoding As Encoding) As Byte()

Parameters:

  • value:
  • encoding:

Utf8StringFromBuffer

Converts the provided byte array to a UTF-8 string.

 

class method Utf8StringFromBuffer(buffer: array of Byte): String

 

static String Utf8StringFromBuffer(Byte[] buffer)

 

Shared Function Utf8StringFromBuffer(buffer As Byte()) As String

Parameters:

  • buffer: Byte buffer containing UTF8 string

Utf8StringToBuffer

Converts provided string to a Byte buffer.

 

class method Utf8StringToBuffer(value: String): array of Byte

 

static Byte[] Utf8StringToBuffer(String value)

 

Shared Function Utf8StringToBuffer(value As String) As Byte()

Parameters:

  • value: String to convert

WideStringFromBuffer

Converts the provided byte array to a UTF-16 string.

 

class method WideStringFromBuffer(buffer: array of Byte): String

 

static String WideStringFromBuffer(Byte[] buffer)

 

Shared Function WideStringFromBuffer(buffer As Byte()) As String

Parameters:

  • buffer: Byte buffer containing Unicode string

WideStringToBuffer

Converts provided string to a Byte buffer.

 

class method WideStringToBuffer(value: String): array of Byte

 

static Byte[] WideStringToBuffer(String value)

 

Shared Function WideStringToBuffer(value As String) As Byte()

Parameters:

  • value: String to convert