Exemple #1
0
        /**
         * Uncompress an array and returns the uncompressed result as a new array.
         *
         * @param compressed compressed array
         * @return uncompressed array
         */
        public int[] uncompress(int[] compressed)
        {
            int[]      decompressed = new int[compressed[0]];
            IntWrapper inpos        = new IntWrapper(1);

            codec.headlessUncompress(compressed, inpos, compressed.Length - inpos.intValue(), decompressed, new IntWrapper(0), decompressed.Length);
            return(decompressed);
        }
        public void headlessUncompress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos, int num)
        {
            int init = inpos.get();

            F1.headlessUncompress(@in, inpos, inlength, @out, outpos, num);
            inlength -= inpos.get() - init;
            num      -= outpos.get();
            F2.headlessUncompress(@in, inpos, inlength, @out, outpos, num);
        }
Exemple #3
0
        public static int[] uncompressHeadless(SkippableIntegerCODEC codec, int[] data, int len)
        {
            int[]      outBuf = new int[len + 1024];
            IntWrapper inPos  = new IntWrapper();
            IntWrapper outPos = new IntWrapper();

            codec.headlessUncompress(data, inPos, data.Length, outBuf, outPos, len);
            if (outPos.get() < len)
            {
                throw new Exception("Insufficient output.");
            }
            return(Arrays.copyOf(outBuf, outPos.get()));
        }