Package ivory.core.compression

Examples of ivory.core.compression.BitInputStream


      Preconditions.checkNotNull(bytes);
      Preconditions.checkArgument(numPostings > 0);
      Preconditions.checkArgument(collectionSize > 0);

      bytesIn = new ByteArrayInputStream(bytes);
      bitsIn = new BitInputStream(bytesIn);

      innerNumPostings = numPostings;
      innerCollectionSize = collectionSize;
      innerGolombParam = (int) Math.ceil(0.69 * ((float) innerCollectionSize)
          / (float) innerNumPostings);
View Full Code Here


    @Override
    public void reset() {
      try {
        bytesIn.reset();
        bitsIn = new BitInputStream(bytesIn);
        cnt = 0;
        needToReadPositions = false;
      } catch (IOException e) {
        e.printStackTrace();
        throw new RuntimeException("Error resetting postings.");
View Full Code Here

    tf = in.readShort();
    totalBits = in.readInt();
    in.readFully(bytes);

    ByteArrayInputStream byteStream = new ByteArrayInputStream(bytes);
    BitInputStream bitStream = new BitInputStream(byteStream);

    positions = new int[tf];
    for (int i = 0; i < tf; i++) {
      if (i == 0) {
        positions[i] = bitStream.readGamma();
      } else {
        positions[i] = (positions[i - 1] + bitStream.readGamma());
      }
    }
  }
View Full Code Here

      Preconditions.checkNotNull(bytes);
      Preconditions.checkArgument(numPostings > 0);
      Preconditions.checkArgument(collectionSize > 0);

      bytesIn = new ByteArrayInputStream(bytes);
      bitsIn = new BitInputStream(bytesIn);
      innerNumPostings = numPostings;
      innerCollectionSize = collectionSize;
      innerGolombParam = (int) Math.ceil(0.69 * ((float) innerCollectionSize)
          / (float) innerNumPostings);
      postingsList = list;
View Full Code Here

    @Override
    public void reset() {
      try {
        bytesIn.reset();
        bitsIn = new BitInputStream(bytesIn);
        cnt = 0;
      } catch (IOException e) {
        e.printStackTrace();
        throw new RuntimeException("Error resetting postings.");
      }
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

    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

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

    @Override
    public void reset() {
      try {
        bytesIn.reset();
        bitsIn = new BitInputStream(bytesIn);
        p = -1;
        prevTf = -1;
        needToReadPositions = false;
      } catch (IOException e) {
        e.printStackTrace();
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.