本文整理汇总了Java中me.lemire.integercompression.IntWrapper类的典型用法代码示例。如果您正苦于以下问题:Java IntWrapper类的具体用法?Java IntWrapper怎么用?Java IntWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IntWrapper类属于me.lemire.integercompression包,在下文中一共展示了IntWrapper类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dec
import me.lemire.integercompression.IntWrapper; //导入依赖的package包/类
@Override
public int dec(int[] in, int[] out, int outOffset, int len) {
IntegerCODEC pfor;
try {
if (pool == null) {
synchronized (this) {
if (pool == null) {
pool = new GenericObjectPool<>(new FastPFORFactory());
}
}
}
pfor = pool.borrowObject();
} catch (Exception ex) {
LOG.log(Level.SEVERE, null, ex);
return -1;
}
int nInts = in[0];
IntWrapper inputoffset = new IntWrapper(1);
IntWrapper outputoffset = new IntWrapper(outOffset);
pfor.uncompress(in, inputoffset, nInts, out, outputoffset);
pool.returnObject(pfor);
return inputoffset.get();
}
示例2: compress
import me.lemire.integercompression.IntWrapper; //导入依赖的package包/类
@Override
public void compress(int[] in, IntWrapper inpos, int inlength, byte[] out,
IntWrapper outpos) {
int inOffset = inpos.get();
int outOffset = outpos.get();
writeUncompressedInt(inlength, out, outOffset);
outOffset+=4;
int offset = GroupVarint.compress(in, inOffset, inlength, out, outOffset);
outOffset+=offset;
inOffset+=inlength;
inpos.set(inOffset);
outpos.set(outOffset);
}
示例3: uncompress
import me.lemire.integercompression.IntWrapper; //导入依赖的package包/类
@Override
public void uncompress(byte[] in, IntWrapper inpos, int inlength,
int[] out, IntWrapper outpos) {
int inOffset = inpos.get();
int outOffset = outpos.get();
int len = readUncompressedInt(in, inOffset);
inOffset+=4;
int offset = GroupVarint.decompress(in, inOffset, out, outOffset, len);
inOffset+=offset;
outOffset+=len;
inpos.set(inOffset);
outpos.set(outOffset);
}
示例4: co
import me.lemire.integercompression.IntWrapper; //导入依赖的package包/类
@Override
public int[] co(int[] in, int offset, int len) {
IntegerCODEC codec = supplier.get();
int[] out = new int[len + 1024];
IntWrapper inputoffset = new IntWrapper(offset);
IntWrapper outputoffset = new IntWrapper(1);
codec.compress(in, inputoffset, len, out, outputoffset);
out[0] = outputoffset.get() - 1;
out = Arrays.copyOf(out, outputoffset.get());
add(len * Integer.BYTES, outputoffset.intValue() * Integer.BYTES);
return out;
}
示例5: dec
import me.lemire.integercompression.IntWrapper; //导入依赖的package包/类
@Override
public int dec(int[] in, int[] out, int outOffset, int len) {
IntegerCODEC codec = supplier.get();
int nInts = in[0];
IntWrapper inputoffset = new IntWrapper(1);
IntWrapper outputoffset = new IntWrapper(outOffset);
codec.uncompress(in, inputoffset, nInts, out, outputoffset);
return inputoffset.get();
}
示例6: co
import me.lemire.integercompression.IntWrapper; //导入依赖的package包/类
@Override
public int[] co(int[] in, int offset, int len) {
IntegerCODEC pfor;
try {
if (pool == null) {
synchronized (this) {
if (pool == null) {
pool = new GenericObjectPool<>(new FastPFORFactory());
}
}
}
pfor = pool.borrowObject();
} catch (Exception ex) {
LOG.log(Level.SEVERE, null, ex);
return null;
}
int[] out = new int[len + 1024];
IntWrapper inputoffset = new IntWrapper(offset);
IntWrapper outputoffset = new IntWrapper(1);
pfor.compress(in, inputoffset, len, out, outputoffset);
out[0] = outputoffset.get() - 1;
out = Arrays.copyOf(out, outputoffset.get());
pool.returnObject(pfor);
add(len * Integer.BYTES, outputoffset.intValue() * Integer.BYTES);
return out;
}
示例7: packInt
import me.lemire.integercompression.IntWrapper; //导入依赖的package包/类
public static int[] packInt(int[] data) {
int[] outBuf = new int[data.length * 4];
IntWrapper inPos = new IntWrapper();
IntWrapper outPos = new IntWrapper();
codec.compress(data, inPos, data.length, outBuf, outPos);
return Arrays.copyOf(outBuf, outPos.get());
}
示例8: unpackInt
import me.lemire.integercompression.IntWrapper; //导入依赖的package包/类
public static int[] unpackInt(int[] data, int len) {
int[] outBuf = new int[len + 1024];
IntWrapper inPos = new IntWrapper();
IntWrapper outPos = new IntWrapper();
codec.uncompress(data, inPos, data.length, outBuf, outPos);
return Arrays.copyOf(outBuf, outPos.get());
}