Package net.sf.cram.io

Examples of net.sf.cram.io.BitOutputStream


    int golombRiceLogM = 2;
    GolombRiceIntegerCodec codec = new GolombRiceIntegerCodec(
        golombRiceLogM);
    for (int i = 0; i < 256; i++) {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      BitOutputStream bos = new DefaultBitOutputStream(baos);
      int len = (int) codec.write(bos, i);
      bos.flush();

      byte[] buf = baos.toByteArray();

      ByteArrayInputStream bais = new ByteArrayInputStream(buf);
      BitInputStream bis = new DefaultBitInputStream(bais);
View Full Code Here


    long bitsLen = 3;
    int golombRiceLogM = 2;
    GolombRiceIntegerCodec codec = new GolombRiceIntegerCodec(
        golombRiceLogM);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BitOutputStream bos = new DefaultBitOutputStream(baos);
    long len = codec.write(bos, value);
    bos.flush();

    assertThat(len, is(bitsLen));

    byte[] buf = baos.toByteArray();
View Full Code Here

    long bitsLen = 3;
    int golombRiceLogM = 2;
    GolombRiceIntegerCodec codec = new GolombRiceIntegerCodec(
        golombRiceLogM);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BitOutputStream bos = new DefaultBitOutputStream(baos);
    long len = codec.write(bos, value);
    bos.flush();

    assertThat(len, is(bitsLen));

    byte[] buf = baos.toByteArray();
View Full Code Here

    long bitsLen = 8;
    int golombRiceLogM = 2;
    GolombRiceIntegerCodec codec = new GolombRiceIntegerCodec(
        golombRiceLogM);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BitOutputStream bos = new DefaultBitOutputStream(baos);
    long len = codec.write(bos, value);
    bos.flush();

    assertThat(len, is(bitsLen));

    byte[] buf = baos.toByteArray();
View Full Code Here

    long bitsLen = 66;
    int golombRiceLogM = 2;
    GolombRiceIntegerCodec codec = new GolombRiceIntegerCodec(
        golombRiceLogM);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BitOutputStream bos = new DefaultBitOutputStream(baos);
    long len = codec.write(bos, value);
    bos.flush();

    assertThat(len, is(bitsLen));

    byte[] buf = baos.toByteArray();
View Full Code Here

  public void becnmark_Write() throws IOException {
    int maxNumbers = 3000000;
    int log2m = 2;
    GolombRiceIntegerCodec codec = new GolombRiceIntegerCodec(log2m);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BitOutputStream bos = new DefaultBitOutputStream(baos);

    for (int i = 0; i < maxNumbers; i++)
      codec.write(bos, 20);

    bos.flush();
    baos.close();
  }
View Full Code Here

  public void testRoundtrip() throws IOException {
    int maxValue = 10000;
    int log2m = 2;
    GolombRiceIntegerCodec codec = new GolombRiceIntegerCodec(log2m);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BitOutputStream bos = new DefaultBitOutputStream(baos);

    for (int i = 0; i < maxValue; i++)
      codec.write(bos, i);

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

    byte[] buf = baos.toByteArray();
    ByteArrayInputStream bais = new ByteArrayInputStream(buf);
    BitInputStream bis = new DefaultBitInputStream(bais);
View Full Code Here

TOP

Related Classes of net.sf.cram.io.BitOutputStream

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.