Package ivory.core.compression

Examples of ivory.core.compression.BitInputStream


    public Reader(byte[] bytes, int n) throws IOException {
      this.termCnt = n;
      if (termCnt > 0) {
        bytesIn = new ByteArrayInputStream(bytes);
        bitsIn = new BitInputStream(bytesIn);
      }
    }
View Full Code Here


    @Override
    public void reset() {
      try {
        bytesIn.reset();
        bitsIn = new BitInputStream(bytesIn);
        p = -1;
        prevTf = -1;
        needToReadPositions = false;
      } catch (IOException e) {
        throw new RuntimeException(e);
View Full Code Here

   * @param bytes Serialized positions
   * @return A decoded integer array of positions
   */
  public static int[] deserializePositions(byte[] bytes) throws IOException {
    ByteArrayInputStream byteStream = new ByteArrayInputStream(bytes);
    BitInputStream bitStream = new BitInputStream(byteStream);

    int[] positions = new int[bitStream.readGamma()];
    for(int i = 0; i < positions.length; i++) {
      if (i == 0) {
        positions[i] = bitStream.readGamma() - 1;
      } else {
        positions[i] = (positions[i - 1] + bitStream.readGamma());
      }
    }

    bitStream.close();

    return positions;
  }
View Full Code Here

TOP

Related Classes of ivory.core.compression.BitInputStream

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.