/** Constructs a new bit writer with the given initial buffer size. */ public BitWriter(int size) { writer = new ome.codecs.BitWriter(size); }
/** Constructs a new bit writer. */ public BitWriter() { writer = new ome.codecs.BitWriter(); }
/** Constructs a new bit writer with the given initial buffer size. */ public BitWriter(int size) { writer = new ome.codecs.BitWriter(size); }
/** Constructs a new bit writer. */ public BitWriter() { writer = new ome.codecs.BitWriter(); }
/** * The CodecOptions parameter must be an instance of * {@link HuffmanCodecOptions}, and should have the following fields set: * {@link HuffmanCodecOptions#table table} * {@link CodecOptions#bitsPerSample bitsPerSample} * {@link CodecOptions#maxBytes maxBytes} * * @see Codec#decompress(RandomAccessInputStream, CodecOptions) */ @Override public byte[] decompress(RandomAccessInputStream in, CodecOptions options) throws CodecException, IOException { if (in == null) throw new IllegalArgumentException("No data to decompress."); if (options == null || !(options instanceof HuffmanCodecOptions)) { throw new CodecException("Options must be an instance of " + "ome.codecs.HuffmanCodecOptions."); } HuffmanCodecOptions huffman = (HuffmanCodecOptions) options; int nSamples = (huffman.maxBytes * 8) / huffman.bitsPerSample; int bytesPerSample = huffman.bitsPerSample / 8; if ((huffman.bitsPerSample % 8) != 0) bytesPerSample++; BitWriter out = new BitWriter(); for (int i=0; i<nSamples; i++) { int sample = getSample(in, options); out.write(sample, bytesPerSample * 8); } return out.toByteArray(); }
int[] nums = new int[trials]; int[] len = new int[trials]; BitWriter bw = new BitWriter(); int totallen = 0;