IdStreamVCL.pas 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. {
  2. $Project$
  3. $Workfile$
  4. $Revision$
  5. $DateUTC$
  6. $Id$
  7. This file is part of the Indy (Internet Direct) project, and is offered
  8. under the dual-licensing agreement described on the Indy website.
  9. (http://www.indyproject.org/)
  10. Copyright:
  11. (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
  12. }
  13. {
  14. $Log$
  15. }
  16. unit IdStreamVCL deprecated;
  17. interface
  18. uses
  19. Classes,
  20. IdGlobal;
  21. type
  22. TIdStreamHelperVCL = class
  23. public
  24. class function ReadBytes(
  25. const AStream: TStream;
  26. var VBytes: TIdBytes;
  27. const ACount: Integer = -1;
  28. const AOffset: Integer = 0) : Integer; deprecated 'Use IdGlobal.ReadTIdBytesFromStream()';
  29. class function Write(
  30. const AStream: TStream;
  31. const ABytes: TIdBytes;
  32. const ACount: Integer = -1;
  33. const AOffset: Integer = 0) : Integer; deprecated 'Use IdGlobal.WriteTIdBytesToStream()';
  34. class function Seek(
  35. const AStream: TStream;
  36. const AOffset: Int64;
  37. const AOrigin: TSeekOrigin) : Int64; deprecated 'use TStream.Seek()';
  38. end;
  39. implementation
  40. {$I IdCompilerDefines.inc}
  41. // RLebeau: must use a 'var' and not an 'out' for the VBytes parameter,
  42. // or else any preallocated buffer the caller passes in will get wiped out!
  43. class function TIdStreamHelperVCL.ReadBytes(const AStream: TStream; var VBytes: TIdBytes;
  44. const ACount, AOffset: Integer): Integer;
  45. {$IFDEF USE_INLINE}inline;{$ENDIF}
  46. begin
  47. Result := IdGlobal.ReadTIdBytesFromStream(AStream, VBytes, ACount, AOffset);
  48. end;
  49. class function TIdStreamHelperVCL.Write(const AStream: TStream; const ABytes: TIdBytes;
  50. const ACount: Integer; const AOffset: Integer): Integer;
  51. {$IFDEF USE_INLINE}inline;{$ENDIF}
  52. begin
  53. Result := IdGlobal.WriteTIdBytesToStream(AStream, ABytes, ACount, AOffset);
  54. end;
  55. class function TIdStreamHelperVCL.Seek(const AStream: TStream; const AOffset: Int64;
  56. const AOrigin: TSeekOrigin): Int64;
  57. {$IFDEF USE_INLINE}inline;{$ENDIF}
  58. begin
  59. Result := AStream.Seek(AOffset, AOrigin);
  60. end;
  61. end.