IdCompressorAbbrevia.pas 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 IdCompressorAbbrevia;
  17. //uses the opensource Abbrevia component set to implement compression
  18. //eg for http gzip decoding
  19. //see http://sourceforge.net/projects/tpabbrevia/
  20. interface
  21. uses
  22. AbGzTyp,
  23. AbUtils,
  24. IdZLibCompressorBase,
  25. IdObjs,
  26. IdSys;
  27. type
  28. //currently just implements gzip decompression.
  29. TIdCompressorAbbrevia = class(TIdZLibCompressorBase)
  30. public
  31. procedure DecompressGZipStream(AInStream, AOutStream : TIdStream); override;
  32. end;
  33. implementation
  34. procedure TIdCompressorAbbrevia.DecompressGZipStream(AInStream, AOutStream : TIdStream);
  35. var
  36. aGz:TAbGzipStreamHelper;
  37. aType:TAbArchiveType;
  38. begin
  39. //no inherited;
  40. aType:=VerifyGZip(AInStream);
  41. Assert(aType=atGzip);
  42. aGz:=TAbGzipStreamHelper.Create(AInStream);
  43. try
  44. aGz.ExtractItemData(AOutStream);
  45. finally
  46. Sys.FreeAndNil(aGz);
  47. end;
  48. end;
  49. end.