factory.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include <util/generic/fwd.h>
  3. #include <util/generic/ptr.h>
  4. #include <util/stream/fwd.h>
  5. /**
  6. * Peeks into the provided input stream to determine its compression format,
  7. * if any, and returns a corresponding decompressing stream. If the stream is
  8. * not compressed, then returns a simple pass-through proxy stream.
  9. *
  10. * Note that returned stream doesn't own the provided input stream, thus it's
  11. * up to the user to free them both.
  12. *
  13. * @param input Input stream.
  14. * @returns Newly constructed stream.
  15. */
  16. THolder<IInputStream> OpenMaybeCompressedInput(IInputStream* input);
  17. /**
  18. * Same as `OpenMaybeCompressedInput`, but returned stream owns the one passed
  19. * into this function.
  20. *
  21. * @param input Input stream.
  22. * @returns Newly constructed stream.
  23. * @see OpenMaybeCompressedInput(IInputStream*)
  24. */
  25. THolder<IInputStream> OpenOwnedMaybeCompressedInput(THolder<IInputStream> input);
  26. /**
  27. * @param input Input stream.
  28. * @returns Newly constructed stream.
  29. * @see OpenMaybeCompressedInput(IInputStream*)
  30. */
  31. THolder<IInputStream> OpenMaybeCompressedInput(const TString& path);
  32. THolder<IInputStream> OpenMaybeCompressedInput(const TString& path, ui32 bufSize);