Class NSDataCompressionAlgorithm


  • public final class NSDataCompressionAlgorithm
    extends java.lang.Object
    Various algorithms provided for compression APIs. See NSData and NSMutableData.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static long LZ4
      LZ4 is appropriate if compression speed is critical.
      static long LZFSE
      LZFSE is the recommended compression algorithm if you don't have a specific reason to use another algorithm.
      static long LZMA
      LZMA is appropriate if compression ratio is critical and memory usage and compression speed are not a factor.
      static long Zlib
      Zlib is appropriate if you want a good balance between compression speed and compression ratio, but only if you need interoperability with non-Apple platforms.
    • Method Summary

      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LZFSE

        public static final long LZFSE
        LZFSE is the recommended compression algorithm if you don't have a specific reason to use another algorithm. Note that LZFSE is intended for use with Apple devices only. This algorithm generally compresses better than Zlib, but not as well as LZMA. It is generally slower than LZ4.
        See Also:
        Constant Field Values
      • LZ4

        public static final long LZ4
        LZ4 is appropriate if compression speed is critical. LZ4 generally sacrifices compression ratio in order to achieve its greater speed. This implementation of LZ4 makes a small modification to the standard format, which is described in greater detail in .
        See Also:
        Constant Field Values
      • LZMA

        public static final long LZMA
        LZMA is appropriate if compression ratio is critical and memory usage and compression speed are not a factor. LZMA is an order of magnitude slower for both compression and decompression than other algorithms. It can also use a very large amount of memory, so if you need to compress large amounts of data on embedded devices with limited memory you should probably avoid LZMA. Encoding uses LZMA level 6 only, but decompression works with any compression level.
        See Also:
        Constant Field Values
      • Zlib

        public static final long Zlib
        Zlib is appropriate if you want a good balance between compression speed and compression ratio, but only if you need interoperability with non-Apple platforms. Otherwise, LZFSE is generally a better choice than Zlib. Encoding uses Zlib level 5 only, but decompression works with any compression level. It uses the raw DEFLATE format as described in IETF RFC 1951.
        See Also:
        Constant Field Values