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); }
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())); }
/** * 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); }
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); }