Package net.sf.cram.io

Examples of net.sf.cram.io.DefaultBitOutputStream


    CanonicalHuffmanIntegerCodec c = new CanonicalHuffmanIntegerCodec(
        cal.values(), cal.bitLens());
    long time6 = System.nanoTime() ;

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DefaultBitOutputStream bos = new DefaultBitOutputStream(baos);
   
    long time1=System.nanoTime() ;
    for (int i = 0; i < size; i++) {
      for (int b : cal.values()) {
        c.write(bos, b);
      }
    }

    bos.close();
    long time2=System.nanoTime() ;

    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    DefaultBitInputStream bis = new DefaultBitInputStream(bais);
View Full Code Here


    int[] lens = new int[] { 1, 2, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8 };
    CanonicalHuffmanIntegerCodec c = new CanonicalHuffmanIntegerCodec(values,
        lens);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DefaultBitOutputStream bos = new DefaultBitOutputStream(baos);
    for (int b : values) {
      c.write(bos, b);
    }

    bos.close();

    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    DefaultBitInputStream bis = new DefaultBitInputStream(bais);

    for (int b : values) {
View Full Code Here

    e.fromByteArray(params.params);

    BitCodec<Integer> codec = e.buildCodec(null, null);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DefaultBitOutputStream bos = new DefaultBitOutputStream(baos);
    for (int i = 0; i < names.length; i++) {
      codec.write(bos, names[i].length());
    }

    bos.close();

    codec = e.buildCodec(null, null);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    DefaultBitInputStream bis = new DefaultBitInputStream(bais);
View Full Code Here

    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.DefaultBitOutputStream

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.