예제 #1
0
        public void headlessCompress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos)
        {
            int init = inpos.get();

            F1.headlessCompress(@in, inpos, inlength, @out, outpos);
            inlength -= inpos.get() - init;
            F2.headlessCompress(@in, inpos, inlength, @out, outpos);
        }
예제 #2
0
        public static int[] compressHeadless(SkippableIntegerCODEC codec, int[] data)
        {
            int[]      outBuf = new int[data.Length * 4];
            IntWrapper inPos  = new IntWrapper();
            IntWrapper outPos = new IntWrapper();

            codec.headlessCompress(data, inPos, data.Length, outBuf, outPos);
            return(Arrays.copyOf(outBuf, outPos.get()));
        }
예제 #3
0
        /**
         * Compress an array and returns the compressed result as a new array.
         *
         * @param input array to be compressed
         * @return compressed array
         */
        public int[] compress(int[] input)
        {
            int[] compressed = new int[input.Length + 1024];
            compressed[0] = input.Length;
            IntWrapper outpos = new IntWrapper(1);

            codec.headlessCompress(input, new IntWrapper(0), input.Length, compressed, outpos);
            compressed = Arrays.copyOf(compressed, outpos.intValue());
            return(compressed);
        }
예제 #4
0
        public void headlessCompress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos)
        {
            int init       = inpos.get();
            int outposInit = outpos.get();

            F1.headlessCompress(@in, inpos, inlength, @out, outpos);
            if (outpos.get() == outposInit)
            {
                @out[outposInit] = 0;
                outpos.increment();
            }
            inlength -= inpos.get() - init;
            F2.headlessCompress(@in, inpos, inlength, @out, outpos);
        }