예제 #1
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()));
        }
예제 #2
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()));
        }
예제 #3
0
 /**
  * Compose a scheme from a first one (f1) and a second one (f2). The first
  * one is called first and then the second one tries to compress whatever
  * remains from the first run.
  *
  * By convention, the first scheme should be such that if, during decoding,
  * a 32-bit zero is first encountered, then there is no output.
  *
  * @param f1
  *            first codec
  * @param f2
  *            second codec
  */
 public SkippableComposition(SkippableIntegerCODEC f1, SkippableIntegerCODEC f2)
 {
     F1 = f1;
     F2 = f2;
 }
예제 #4
0
 /**
  * Constructor with default codec.
  */
 public IntCompressor()
 {
     codec = new SkippableComposition(new BinaryPacking(), new VariableByte());
 }
예제 #5
0
 /**
  * Constructor wrapping a codec.
  *
  * @param c the underlying codec
  */
 public IntCompressor(SkippableIntegerCODEC c)
 {
     codec = c;
 }