private static int readVarInt(ByteBuffer buff) { return DataUtils.readVarInt(buff); }
@Override public Object read(ByteBuffer buff, int tag) { switch (tag) { case TYPE_INT: return DataUtils.readVarInt(buff); case TAG_INTEGER_NEGATIVE: return -DataUtils.readVarInt(buff); case TAG_INTEGER_FIXED: return buff.getInt(); } return tag - TAG_INTEGER_0_15; }
@Override public Object read(ByteBuffer buff, int tag) { int len; if (tag == TYPE_STRING) { len = DataUtils.readVarInt(buff); } else { len = tag - TAG_STRING_0_15; } return DataUtils.readString(buff, len); }
@Override public String read(ByteBuffer buff) { int len = DataUtils.readVarInt(buff); return DataUtils.readString(buff, len); }
@Override public Object read(ByteBuffer buff, int tag) { switch (tag) { case TAG_FLOAT_0: return 0f; case TAG_FLOAT_1: return 1f; case TAG_FLOAT_FIXED: return buff.getFloat(); } return Float.intBitsToFloat(Integer.reverse(DataUtils .readVarInt(buff))); }
/** * Check whether the id itself contains all the data. This operation does * not cause any reads in the map. * * @param id the id * @return if the id contains the data */ public boolean isInPlace(byte[] id) { ByteBuffer idBuffer = ByteBuffer.wrap(id); while (idBuffer.hasRemaining()) { if (idBuffer.get() != 0) { return false; } int len = DataUtils.readVarInt(idBuffer); idBuffer.position(idBuffer.position() + len); } return true; }
@Override public Object read(ByteBuffer buff, int tag) { switch (tag) { case TAG_BIG_DECIMAL_0: return BigDecimal.ZERO; case TAG_BIG_DECIMAL_1: return BigDecimal.ONE; case TAG_BIG_DECIMAL_SMALL: return BigDecimal.valueOf(DataUtils.readVarLong(buff)); case TAG_BIG_DECIMAL_SMALL_SCALED: int scale = DataUtils.readVarInt(buff); return BigDecimal.valueOf(DataUtils.readVarLong(buff), scale); } int scale = DataUtils.readVarInt(buff); int len = DataUtils.readVarInt(buff); byte[] bytes = Utils.newBytes(len); buff.get(bytes); BigInteger b = new BigInteger(bytes); return new BigDecimal(b, scale); }
@Override public Object read(ByteBuffer buff, int tag) { int len = DataUtils.readVarInt(buff); byte[] data = Utils.newBytes(len); int size = data.length * 2; // adjust the average size // using an exponential moving average averageSize = (size + 15 * averageSize) / 16; buff.get(data); return deserialize(data); }
@Override public Object read(ByteBuffer buff, int tag) { switch (tag) { case TAG_BIG_INTEGER_0: return BigInteger.ZERO; case TAG_BIG_INTEGER_1: return BigInteger.ONE; case TAG_BIG_INTEGER_SMALL: return BigInteger.valueOf(DataUtils.readVarLong(buff)); } int len = DataUtils.readVarInt(buff); byte[] bytes = Utils.newBytes(len); buff.get(bytes); return new BigInteger(bytes); }
case 0: len = DataUtils.readVarInt(idBuffer); idBuffer.position(idBuffer.position() + len); buff.append("data len=").append(len); case 1: len = DataUtils.readVarInt(idBuffer); length += len; block = DataUtils.readVarLong(idBuffer); case 2: len = DataUtils.readVarInt(idBuffer); length += DataUtils.readVarLong(idBuffer); block = DataUtils.readVarLong(idBuffer);
case 0: int len = DataUtils.readVarInt(idBuffer); idBuffer.position(idBuffer.position() + len); length += len; case 1: length += DataUtils.readVarInt(idBuffer); DataUtils.readVarLong(idBuffer); break;
case 0: int len = DataUtils.readVarInt(idBuffer); idBuffer.position(idBuffer.position() + len); break; case 1: DataUtils.readVarInt(idBuffer); long k = DataUtils.readVarLong(idBuffer); map.remove(k);
case 0: int len = DataUtils.readVarInt(idBuffer); idBuffer.position(idBuffer.position() + len); break; case 1: DataUtils.readVarInt(idBuffer); long k = DataUtils.readVarLong(idBuffer); maxKey = Math.max(maxKey, k);
switch (idBuffer.get()) { case 0: { int len = DataUtils.readVarInt(idBuffer); if (skip >= len) { skip -= len; int len = DataUtils.readVarInt(idBuffer); long key = DataUtils.readVarLong(idBuffer); if (skip >= len) {
@Override public Object read(ByteBuffer buff) { int flags = DataUtils.readVarInt(buff); if (flags == -1) { long id = DataUtils.readVarLong(buff); return new SpatialKey(id); } float[] minMax = new float[dimensions * 2]; for (int i = 0; i < dimensions; i++) { float min = buff.getFloat(); float max; if ((flags & (1 << i)) != 0) { max = min; } else { max = buff.getFloat(); } minMax[i + i] = min; minMax[i + i + 1] = max; } long id = DataUtils.readVarLong(buff); return new SpatialKey(id, minMax); }
clazz = COMMON_CLASSES[ct]; int len = DataUtils.readVarInt(buff); try { obj = Array.newInstance(clazz, len);
int mapId = DataUtils.readVarInt(chunk); int entries = DataUtils.readVarInt(chunk); int type = chunk.get(); boolean compressed = (type & DataUtils.PAGE_COMPRESSED) != 0; DataUtils.PAGE_COMPRESSED_HIGH); Compressor compressor = getCompressor(fast); int lenAdd = DataUtils.readVarInt(chunk); int compLen = pageSize + start - chunk.position(); byte[] comp = Utils.newBytes(compLen);
int m = DataUtils.readVarInt(buff); if (m != mapId) { throw DataUtils.newIllegalStateException( chunkId, checkTest, check); int len = DataUtils.readVarInt(buff); int type = buff.get(); boolean node = (type & 1) == DataUtils.PAGE_TYPE_NODE;
int mapId = DataUtils.readVarInt(buff); if (mapId != map.getId()) { throw DataUtils.newIllegalStateException( chunkId, checkTest, check); int len = DataUtils.readVarInt(buff); keys = new Object[len]; int type = buff.get(); compressor = map.getStore().getCompressorFast(); int lenAdd = DataUtils.readVarInt(buff); int compLen = pageLength + start - buff.position(); byte[] comp = Utils.newBytes(compLen);
@Override public Object read(ByteBuffer buff, int tag) { switch (tag) { case TYPE_INT: return DataUtils.readVarInt(buff); case TAG_INTEGER_NEGATIVE: return -DataUtils.readVarInt(buff); case TAG_INTEGER_FIXED: return buff.getInt(); } return tag - TAG_INTEGER_0_15; }