本文整理匯總了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());
}