Examples of BitOutputStream


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

Examples of net.sf.cram.io.BitOutputStream

    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

Examples of net.sf.cram.io.BitOutputStream

    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

Examples of net.sf.cram.io.BitOutputStream

    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

Examples of net.sf.cram.io.BitOutputStream

    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

Examples of net.sf.cram.io.BitOutputStream

  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

Examples of net.sf.cram.io.BitOutputStream

  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

Examples of org.kc7bfi.jflac.io.BitOutputStream

    protected AudioInputStream getAudioInputStream(InputStream inputStream, int medialength) throws UnsupportedAudioFileException, IOException {
        AudioFileFormat audioFileFormat = getAudioFileFormat(inputStream, medialength);

        // push back the StreamInfo
        ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
        BitOutputStream bitOutStream = new BitOutputStream(byteOutStream);
        bitOutStream.writeByteBlock(Constants.STREAM_SYNC_STRING, Constants.STREAM_SYNC_STRING.length);
        /**
         * TODO what if StreamInfo not last?
         */
        streamInfo.write(bitOutStream, false);

View Full Code Here

Examples of org.kc7bfi.jflac.io.BitOutputStream

        // get output file
        File outFile = getOutputFile();
        if (outFile == null) {
            return;
        }
        BitOutputStream os = null;
        FileOutputStream fos;
        try {
            fos = new FileOutputStream(outFile);
            os = new BitOutputStream(fos);
        }
        catch (FileNotFoundException e1) {
            e1.printStackTrace();
            return;
        }

        // get seek table
        SeekTable seekTable = makeSeekTable();
        if (masterStreamInfo == null) {
            return;
        }

        // write FLAC marker
        os.writeByteBlock(Constants.STREAM_SYNC_STRING, Constants.STREAM_SYNC_STRING.length);

        // output StreamInfo
        masterStreamInfo.write(os, false);

        // output SeekTable
View Full Code Here

Examples of org.terrier.compression.BitOutputStream

   * @param size number of runs in disk.
   * @param fileName String with the file name of the final inverted file.
   * @throws IOException if an I/O error occurs.
   */
  protected void init(int size, String fileName) throws Exception{
    this.init(size, new BitOutputStream(fileName));
  }
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.