jflz.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef JFLZ_INCL
  14. #define JFLZ_INCL
  15. #include "jlzw.hpp"
  16. #define FASTCOMPRESSEDFILEBLOCKSIZE (0x10000)
  17. extern jlib_decl ICompressor *createFastLZCompressor();
  18. extern jlib_decl IExpander *createFastLZExpander();
  19. extern jlib_decl void fastLZCompressToBuffer(MemoryBuffer & out, size32_t len, const void * src);
  20. extern jlib_decl void fastLZDecompressToBuffer(MemoryBuffer & out, const void * src);
  21. extern jlib_decl void fastLZDecompressToBuffer(MemoryBuffer & out, MemoryBuffer & in);
  22. extern jlib_decl void fastLZDecompressToAttr(MemoryAttr & out, const void * src);
  23. extern jlib_decl void fastLZDecompressToBuffer(MemoryAttr & out, MemoryBuffer & in);
  24. // basic routines
  25. extern jlib_decl size32_t fastlz_compress(const void* input, size32_t inlength, void* output);
  26. // returns compressed size
  27. // output length must be at least inlength+fastlzSlack(inlength)
  28. extern jlib_decl size32_t fastlz_decompress(const void* input, size32_t inlength, void* output, size32_t maxout);
  29. inline size32_t fastlzSlack(size32_t sz) { size32_t ret=sz/16; return (ret<66)?66:ret; }
  30. extern jlib_decl IFileIOStream *createFastLZStreamRead(IFileIO *base);
  31. extern jlib_decl IFileIOStream *createFastLZStreamWrite(IFileIO *base);
  32. #endif