Show: Delphi C++
Display Preferences

System.SysUtils.TEncoding.GetBytes

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function GetBytes(Chars: PChar; CharCount: Integer; Bytes: PByte; ByteCount: Integer): Integer; overload; virtual; abstract;
function GetBytes(const Chars: Char): TBytes; overload; inline;
function GetBytes(const Chars: array of Char): TBytes; overload;
function GetBytes(const Chars: TCharArray): TBytes; overload;
function GetBytes(const Chars: array of Char; CharIndex, CharCount: Integer): TBytes; overload;
function GetBytes(const Chars: TCharArray; CharIndex, CharCount: Integer): TBytes; overload;
function GetBytes(const Chars: array of Char; CharIndex, CharCount: Integer;  const Bytes: TBytes; ByteIndex: Integer): Integer; overload;
function GetBytes(const Chars: TCharArray; CharIndex, CharCount: Integer;  const Bytes: TBytes; ByteIndex: Integer): Integer; overload;
function GetBytes(const S: string): TBytes; overload;
function GetBytes(const S: string; CharIndex, CharCount: Integer;  const Bytes: TBytes; ByteIndex: Integer): Integer; overload; inline;
function GetBytes(const S: string; CharIndex, CharCount: Integer;  const Bytes: TBytes; ByteIndex: Integer; const StringBaseIndex: Integer): Integer; overload; // new

C++

virtual int __fastcall GetBytes(System::WideChar * Chars, int CharCount, System::PByte Bytes, int ByteCount) = 0 /* overload */;
System::DynamicArray<System::Byte> __fastcall GetBytes(const System::WideChar Chars)/* overload */;
System::DynamicArray<System::Byte> __fastcall GetBytes(const System::WideChar *Chars, const int Chars_High)/* overload */;
System::DynamicArray<System::Byte> __fastcall GetBytes(const System::DynamicArray<System::WideChar> Chars)/* overload */;
System::DynamicArray<System::Byte> __fastcall GetBytes(const System::WideChar *Chars, const int Chars_High, int CharIndex, int CharCount)/* overload */;
System::DynamicArray<System::Byte> __fastcall GetBytes(const System::DynamicArray<System::WideChar> Chars, int CharIndex, int CharCount)/* overload */;
int __fastcall GetBytes(const System::WideChar *Chars, const int Chars_High, int CharIndex, int CharCount, const System::DynamicArray<System::Byte> Bytes, int ByteIndex)/* overload */;
int __fastcall GetBytes(const System::DynamicArray<System::WideChar> Chars, int CharIndex, int CharCount, const System::DynamicArray<System::Byte> Bytes, int ByteIndex)/* overload */;
System::DynamicArray<System::Byte> __fastcall GetBytes(const System::UnicodeString S)/* overload */;
int __fastcall GetBytes(const System::UnicodeString S, int CharIndex, int CharCount, const System::DynamicArray<System::Byte> Bytes, int ByteIndex)/* overload */;
int __fastcall GetBytes(const System::UnicodeString S, int CharIndex, int CharCount, const System::DynamicArray<System::Byte> Bytes, int ByteIndex, const int StringBaseIndex)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.SysUtils.pas
System.SysUtils.hpp
System.SysUtils TEncoding

Description

Encodes a set of characters from the specified string or characters.

  • function GetBytes(Chars: PChar; CharCount: Integer; Bytes: PByte; ByteCount: Integer): Integer; overload; virtual; abstract;
This overload version is an abstract method in this class. Actual implementation is deferred to a descendent classs.
  • function GetBytes(const Chars: Char): TBytes; overload;
Encodes and returns a Chars character as a sequence of bytes.
  • Chars: One UNICODE character that to encode.
Return Value is a byte array containing the results of encoding the specified character sequence.
  • function GetBytes(const Chars: array of Char): TBytes; overload;
  • function GetBytes(const Chars: TCharArray): TBytes; overload;
Encodes and returns the sequence of characters of Chars array as a sequence of bytes.
  • Chars: array of char that contains the set of characters to encode.
Return Value is a byte array containing the results of encoding the specified character sequence.
  • function GetBytes(const Chars: array of Char; CharIndex, CharCount: Integer): TBytes; overload;
  • function GetBytes(const Chars: TCharArray; CharIndex, CharCount: Integer): TBytes; overload;
Encodes and returns the sequence of CharCount characters from CharIndex of Chars array as a sequence of bytes.
  • Chars: array of char that contains the set of characters to encode.
  • CharIndex: index of the first character to encode on Chars array.
  • CharCount: parameter that specifies the number of characters to encode.
Return Value is a byte array containing the results of encoding the specified character sequence.
  • function GetBytes(const Chars: array of Char; CharIndex, CharCount: Integer; const Bytes: TBytes; ByteIndex: Integer): Integer; overload;
  • function GetBytes(const Chars: TCharArray; CharIndex, CharCount: Integer; const Bytes: TBytes; ByteIndex: Integer): Integer; overload;
Encodes the sequence of CharCount characters from CharIndex of Chars into Bytes as a sequence of bytes.
  • Chars: array of char that contains the set of characters to encode.
  • CharIndex: index of the first character to encode on Chars array.
  • CharCount: parameter that specifies the number of characters to encode.
  • Bytes: byte array that contains the resulting sequence of bytes. It specifies the location where the sequence of bytes is recorded.
Return Value is the actual number of bytes written into Bytes.
  • function GetBytes(const S: string): TBytes; overload;
Encodes and returns S string as a sequence of bytes.
  • S: string that contains the set of characters to encode.
Return Value is a byte array containing the results of encoding the specified string.
  • function GetBytes(const S: string; CharIndex, CharCount: Integer; const Bytes: TBytes; ByteIndex: Integer): Integer; overload;
Encodes CharCount characters from CharIndex index of string S into Bytes array with ByteIndex offset as a sequence of bytes. CharIndex is one-based index on Desktop platforms including Windows, Mac OS X, and Linux, or zero-based on Mobile platforms including iOS and Android.
  • S: string that contains the set of characters to encode.
  • CharIndex: index of the first character to encode. On Desktop platforms including Windows, Mac OS X, and Linux, CharIndex is one-based. On Mobile platforms including iOS and Android, CharIndex is zero-based.
  • CharCount: parameter that specifies the number of characters to encode.
  • Bytes: byte array that contains the resulting sequence of bytes. It specifies the location where the sequence of bytes is recorded.
  • ByteIndex: index starting from which the resulting sequence of bytes is recorded.
Return Value is the actual number of bytes written into Bytes.
  • function GetBytes(const S: string; CharIndex, CharCount: Integer; const Bytes: TBytes; ByteIndex: Integer; const StringBaseIndex: Integer): Integer; overload;
Encodes CharCount characters from CharIndex index of string S into Bytes array with ByteIndex offset as a sequence of bytes. StringBaseIndex is the base index number; 0 or 1 of CharIndex on the S string.
  • S: string that contains the set of characters to encode.
  • CharIndex: index of the first character to encode. Index base is controlled by StringBaseIndex
  • CharCount: parameter that specifies the number of characters to encode.
  • Bytes: byte array that contains the resulting sequence of bytes. It specifies the location where the sequence of bytes is recorded.
  • ByteIndex: index starting from which the resulting sequence of bytes is recorded.
  • StringBaseIndex: base index number of CharIndex on the s string. This value is 0 or 1. If other number is specified, EEncodingError exception is raised.
Return Value is the actual number of bytes written into Bytes.


See Also


Code Examples

Personal tools
In Other Languages
Previous Versions
Assistance