コード例 #1
0
  @Override
  public Integer read(BitInputStream bis) throws IOException {
    long buf = 0; // huffman code
    int bitsRead = 0;
    for (int len : codeLentghSorted) {
      buf = buf << (len - bitsRead);

      long readLongBits = bis.readLongBits(len - bitsRead);

      buf = buf | readLongBits;

      bitsRead = len;
      Map<Long, Integer> codeMap = codeMaps[len];
      Integer result = codeMap.get(buf);
      if (result != null) {
        return result;
      }
    }
    throw new RuntimeException(
        "Bit code not found. Current state: " + bitsRead + " bits read, buf=" + buf);
  }
コード例 #2
0
ファイル: BetaIntegerCodec.java プロジェクト: mnter/htsjdk
 @Override
 public final Integer read(final BitInputStream bitInputStream) throws IOException {
   return bitInputStream.readBits(readNofBits) - offset;
 }