Package net.sf.cram.encoding

Examples of net.sf.cram.encoding.HuffmanIntegerEncoding


    int[] lens = c.bitLens();
    System.out.println(Arrays.toString(values));
    System.out.println(Arrays.toString(lens));

    EncodingParams params = HuffmanIntegerEncoding.toParam(values, lens);
    HuffmanIntegerEncoding e = new HuffmanIntegerEncoding();
    e.fromByteArray(params.params);

    BitCodec<Integer> codec = e.buildCodec(null, null);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DefaultBitOutputStream bos = new DefaultBitOutputStream(baos);
    for (int i = 0; i < names.length; i++) {
      codec.write(bos, names[i].length());
    }

    bos.close();

    codec = e.buildCodec(null, null);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    DefaultBitInputStream bis = new DefaultBitInputStream(bais);

    for (int i = 0; i < names.length; i++) {
      int v = codec.read(bis);
View Full Code Here


          c.calculate();

          EncodingParams param = HuffmanIntegerEncoding.toParam(
              c.values(), c.bitLens());
          HuffmanIntegerEncoding he = new HuffmanIntegerEncoding();
          he.fromByteArray(param.params);
          EncodingLengthCalculator lc = new EncodingLengthCalculator(
              he);
          for (Integer value : dictionary.keySet())
            lc.add(value, dictionary.get(value).value);
View Full Code Here

TOP

Related Classes of net.sf.cram.encoding.HuffmanIntegerEncoding

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.