类 HoffmanEncoder

  • 所有已实现的接口:
    Encoder

    public class HoffmanEncoder
    extends java.lang.Object
    implements Encoder
    Hoffman encoding
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      byte[] decode​(Bits encodedBits)  
      Bits encode​(byte[] in_data, int in_len)
      1.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • HoffmanEncoder

        public HoffmanEncoder()
    • 方法详细资料

      • encode

        public Bits encode​(byte[] in_data,
                           int in_len)
        1. Sort the probability of all source symbols in a descending order. 2. Merge the last two into a new symbol, add their probabilities. 3. Repeat Step 1, 2 until only one symbol (the root) is left. 4. Code assignment: Traverse the tree from the root to each leaf node, assign 0 to the top branch and 1 to the bottom branch
        参数:
        in_data - in_data
        in_len - in_len
        返回:
        Bits
      • decode

        public byte[] decode​(Bits encodedBits)