Examples of readBits()


Examples of com.peterhi.runtime.BitStream.readBits()

      for (Map.Entry<BigInteger, Integer> entry : numbers.entrySet()) {
        BigInteger number = entry.getKey();
        Integer size = entry.getValue();
       
        if (size == Byte.SIZE) {
          assertEquals(number.byteValue(), bs.readBits(size, true).byteValue());
        } else if (size == Short.SIZE) {
          assertEquals(number.shortValue(), bs.readBits(size, true).shortValue());
        } else if (size == Integer.SIZE) {
          assertEquals(number.intValue(), bs.readBits(size, true).intValue());
        } else if (size == Long.SIZE) {
View Full Code Here

Examples of it.unimi.dsi.io.InputBitStream.readBits()

          final InputBitStream ibs = new InputBitStream( bapl.buffer );
          frequency = bapl.frequency; // This could be much more than the actual frequency in virtual indices

          // Calculate posting bit positions and corresponding pointers
          for ( int j = 0; j < frequency; j++ ) {
            bitPos[ j ] = ibs.readBits(); // Cache bit poisition
            pointer[ j ] = ibs.readDelta(); // Cache pointer
            if ( hasCounts ) count = ibs.readGamma() + 1;
            if ( hasPositions ) ibs.skipDeltas( count ); // Skip document positions
          }
View Full Code Here

Examples of it.unimi.dsi.io.InputBitStream.readBits()

   * @throws IOException
   */
  public void stripPointers( final OutputBitStream obs, final long bitLength ) throws IOException {
    final InputBitStream ibs = new InputBitStream( buffer );
    int count;
    while( ibs.readBits() < bitLength ) {
      ibs.readDelta(); // Discard pointer
      if ( completeness >= COUNTS.ordinal() ) {
        count = ibs.readGamma() + 1;
        obs.writeGamma( count - 1 );
        if ( completeness >= POSITIONS.ordinal() ) while( count-- != 0 ) obs.writeDelta( ibs.readDelta() );
View Full Code Here

Examples of javax.imageio.stream.ImageInputStream.readBits()

        i.setBitOffset(6);

        exceptionThrown = false;
        try
          {
            i.readBits(-1);
          }
        catch (IllegalArgumentException e)
          {
            exceptionThrown = true;
          }
View Full Code Here

Examples of javax.imageio.stream.ImageInputStream.readBits()

        h.check(exceptionThrown);

        exceptionThrown = false;
        try
          {
            i.readBits(65);
          }
        catch (IllegalArgumentException e)
          {
            exceptionThrown = true;
          }
View Full Code Here

Examples of javax.imageio.stream.ImageInputStream.readBits()

          {
            exceptionThrown = true;
          }
        h.check(exceptionThrown);

        h.check(i.readBits(59) == 366848453836545810L);

        i.seek(5);
        i.setBitOffset(6);
        h.check(i.readBits(58) == 183424226918272905L);
View Full Code Here

Examples of javax.imageio.stream.ImageInputStream.readBits()

        h.check(i.readBits(59) == 366848453836545810L);

        i.seek(5);
        i.setBitOffset(6);
        h.check(i.readBits(58) == 183424226918272905L);

        b = new byte[]
          {
            (byte) 0xa2, (byte) 0xe9, (byte) 0xd7, (byte) 0x34,
            (byte) 0x2a, (byte) 0x83, (byte) 0xe2, (byte) 0x40
View Full Code Here

Examples of javax.imageio.stream.ImageInputStream.readBits()

            (byte) 0xa2, (byte) 0xe9, (byte) 0xd7, (byte) 0x34,
            (byte) 0x2a, (byte) 0x83, (byte) 0xe2, (byte) 0x40
          };
        bs = new ByteArrayInputStream(b);
        i = new MemoryCacheImageInputStream(bs);
        h.check(i.readBits(59) == 366848453836545810L);

        b = new byte[]
          {
            (byte) 0xa2, (byte) 0x02
          };
View Full Code Here

Examples of javax.imageio.stream.ImageInputStream.readBits()

        long[] res = new long[8];

        i.seek(0);

        h.check(i.readBits(0) == 0);
        i.seek(0);

        for (k = 0; k < 8; k++)
          {
            i.setBitOffset(k);
View Full Code Here

Examples of javax.imageio.stream.ImageInputStream.readBits()

        i.seek(0);

        for (k = 0; k < 8; k++)
          {
            i.setBitOffset(k);
            res[k] = i.readBits(8);
            i.seek(0);
          }
        i.seek(0);
        h.check(Arrays.equals(res, new long[] { 162, 68, 136, 16,
                                                32, 64, 128, 1 }));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.