Examples of BitInputStream


Examples of lupos.compression.bitstream.BitInputStream

  /**
   * Constructor
   * @param in the underlying input stream, from which a bit input stream is created and from which for each block the huffman tree is read and the huffman encoded block
   */
  public HuffmanInputStream(final InputStream in){
    this.in = new BitInputStream(in);
  }
View Full Code Here

Examples of net.sf.cram.io.BitInputStream

      bos.flush();

      byte[] buf = baos.toByteArray();

      ByteArrayInputStream bais = new ByteArrayInputStream(buf);
      BitInputStream bis = new DefaultBitInputStream(bais);
      long number = codec.read(bis);
      System.out.printf("%d: %d\t%s\t%d\t%s\n", i, number, IOUtils
          .toBitString(buf).subSequence(0, len), len, IOUtils
          .toBitString(buf));
    }
View Full Code Here

Examples of net.sf.cram.io.BitInputStream

    assertThat(len, is(bitsLen));

    byte[] buf = baos.toByteArray();

    ByteArrayInputStream bais = new ByteArrayInputStream(buf);
    BitInputStream bis = new DefaultBitInputStream(bais);
    int number = codec.read(bis);
    assertThat(number, is(value));

    String bitsString = IOUtils.toBitString(buf);
    assertThat(bitsString, equalTo("10000000"));
View Full Code Here

Examples of net.sf.cram.io.BitInputStream

    assertThat(len, is(bitsLen));

    byte[] buf = baos.toByteArray();

    ByteArrayInputStream bais = new ByteArrayInputStream(buf);
    BitInputStream bis = new DefaultBitInputStream(bais);
    int number = codec.read(bis);
    assertThat(number, is(value));

    String bitsString = IOUtils.toBitString(buf);
    assertThat(bitsString, equalTo("10100000"));
View Full Code Here

Examples of net.sf.cram.io.BitInputStream

    assertThat(len, is(bitsLen));

    byte[] buf = baos.toByteArray();

    ByteArrayInputStream bais = new ByteArrayInputStream(buf);
    BitInputStream bis = new DefaultBitInputStream(bais);
    int number = codec.read(bis);
    assertThat(number, is(value));

    String bitsString = IOUtils.toBitString(buf);
    assertThat(bitsString, equalTo("00000100"));
View Full Code Here

Examples of net.sf.cram.io.BitInputStream

    assertThat(len, is(bitsLen));

    byte[] buf = baos.toByteArray();

    ByteArrayInputStream bais = new ByteArrayInputStream(buf);
    BitInputStream bis = new DefaultBitInputStream(bais);
    int number = codec.read(bis);
    assertThat(number, is(value));

    String bitsString = IOUtils.toBitString(buf);
    assertThat(
View Full Code Here

Examples of net.sf.cram.io.BitInputStream

    byte oneByteValue = 20;

    byte[] buf = new byte[maxNumbers];
    Arrays.fill(buf, oneByteValue);
    ByteArrayInputStream bais = new ByteArrayInputStream(buf);
    BitInputStream bis = new DefaultBitInputStream(bais);
    for (int i = 0; i < maxNumbers; i++)
      codec.read(bis);
  }
View Full Code Here

Examples of net.sf.cram.io.BitInputStream

    bos.flush();
    baos.close();

    byte[] buf = baos.toByteArray();
    ByteArrayInputStream bais = new ByteArrayInputStream(buf);
    BitInputStream bis = new DefaultBitInputStream(bais);
    for (int i = 0; i < maxValue; i++)
      assertThat(codec.read(bis), is(i));
  }
View Full Code Here

Examples of org.apache.sanselan.common.BitInputStream

    private void interpretTile(BufferedImage bi, byte bytes[], int startX,
            int startY) throws ImageReadException, IOException
    {
        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
        BitInputStream bis = new BitInputStream(bais);

        int pixelsPerTile = tileWidth * tileLength;

        int tileX = 0, tileY = 0;

        for (int i = 0; i < pixelsPerTile; i++)
        {

            int x = tileX + startX;
            int y = tileY + startY;

            int samples[] = getSamplesAsBytes(bis);

            if ((x < width) && (y < height))
            {
                samples = applyPredictor(samples, x);
                photometricInterpreter.interpretPixel(bi, samples, x, y);
            }

            tileX++;

            if (tileX >= tileWidth)
            {
                tileX = 0;
                tileY++;
                bis.flushCache();
                if (tileY >= tileLength)
                    break;
            }

        }
View Full Code Here

Examples of org.apache.sanselan.common.BitInputStream

    private void interpretStrip(BufferedImage bi, byte bytes[],
            int pixels_per_strip) throws ImageReadException, IOException
    {
        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
        BitInputStream bis = new BitInputStream(bais);

        for (int i = 0; i < pixels_per_strip; i++)
        {
            int samples[] = getSamplesAsBytes(bis);

            if ((x < width) && (y < height))
            {
                samples = applyPredictor(samples, x);

                photometricInterpreter.interpretPixel(bi, samples, x, y);
            }

            x++;
            if (x >= width)
            {
                x = 0;
                y++;
                bis.flushCache();
                if (y >= height)
                    break;
            }
        }
    }
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.