Download Now

    Reference TBuffer

    Declared in Codebot.Text.pas on line 66

    TBuffer is a managed block of memory and is used when converting between text encodings and binary data
      TBuffer = record
      public
        { Allocate size number of bytes }
        class function Create(Size: LongInt): TBuffer; static;
        { Implicitly convert TBuffer to a memory address }
        class operator Implicit(const Value: TBuffer): Pointer;
        { Encode a buffer to a string using an encoding method }
        function Encode(Method: TEncodeMethod = encodeBase64): string;
        { Load buffer from a file }
        procedure LoadFromFile(const FileName: string);
        { Load buffer from a stream }
        procedure LoadFromStream(Stream: TStream);
        { Save buffer to a file }
        procedure SaveToFile(const FileName: string);
        { Save buffer to a stream }
        procedure SaveToStream(Stream: TStream);
        { The memory address where TBuffer stores data Remarks The memory will be
          valid until buffer goes out of scope or it is resized }
        property Data: Pointer read GetData;
        { The number of bytes allocated by buffer }
        property Size: LongInt read GetSize write SetSize;
        { Convert data to a string }
        property AsString: string read GetAsString;
        { Convert data to a hexadecimal string }
        property AsHex: string read GetAsHex;
        { Convert data to a base 64 string }
        property AsBase64: string read GetAsBase64;
      end;

    See also