zoukankan      html  css  js  c++  java
  • mormot2 TRawByteStringStream

    mormot2 TRawByteStringStream

    mormot.core.base.pas

      /// TStream using a RawByteString as internal storage
      // - default TStringStream uses WideChars since Delphi 2009, so it is
      // not compatible with previous versions, and it does make sense to
      // work with RawByteString/RawUTF8 in our UTF-8 oriented framework
      // - just like TStringStream, is designed for appending data, not modifying
      // in-place, as requested e.g. by TTextWriter or TBufferWriter classes
      TRawByteStringStream = class(TStream)
      protected
        fPosition: integer;
        fDataString: RawByteString;
        {$ifdef FPC}
        function GetPosition: Int64; override;
        {$endif FPC}
        function  GetSize: Int64; override;
        procedure SetSize(NewSize: Longint); override;
      public
        /// initialize a void storage
        constructor Create; overload;
        /// initialize the storage, optionally with some RawByteString content
        constructor Create(const aString: RawByteString); overload;
        /// read some bytes from the internal storage
        // - returns the number of bytes filled into Buffer (<=Count)
        function Read(var Buffer; Count: Longint): Longint; override;
        /// change the current Read/Write position, within current stored range
        function Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; override;
        /// change the current Read/Write position, within current stored range
        function Seek(Offset: Longint; Origin: Word): Longint; override;
        /// append some data to the buffer
        // - will resize the buffer, i.e. will replace the end of the string from
        // the current position with the supplied data
        function Write(const Buffer; Count: Longint): Longint; override;
        /// retrieve the stored content from a given position, as UTF-8 text
        procedure GetAsText(StartPos, Len: PtrInt; var Text: RawUTF8);
        /// direct low-level access to the internal RawByteString storage
        property DataString: RawByteString
          read fDataString write fDataString;
      end;
    

      

  • 相关阅读:
    实验 4:Open vSwitch 实验——Mininet 中使用 OVS 命令
    实验 3:Mininet 实验——测量路径的损耗率
    软工第一次作业
    实验2:Mininet实验——拓扑的命令脚本生成
    实验 1:Mininet 源码安装和可视化拓扑工具
    AU降噪处理
    软件测试,Homework3
    软件测试,Lab1
    软件测试,Homework2
    node.js,同时访问出错,Can't set headers after they are sent
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/14055758.html
Copyright © 2011-2022 走看看