@Override public Long valueArrayBinaryGet(DataInput2 input, int keysLen, int pos) throws IOException { long a = 0; while (pos-- >= 0) { a += input.unpackLong(); } return a; }
@Override public Long valueArrayBinaryGet(DataInput2 input, int keysLen, int pos) throws IOException { input.unpackLongSkip(pos); return input.unpackLong(); }
@Override public Node deserialize(@NotNull DataInput2 input, int available) throws IOException { int keysLen = DataIO.parity1Get(input.unpackInt())>>>1; int flags = keysLen & 0xF; keysLen = keysLen>>>4; long link = (flags&RIGHT)!=0 ? 0L : input.unpackLong(); Object keys = keysLen==0? keySerializer.valueArrayEmpty() : keySerializer.valueArrayDeserialize(input, keysLen); if(CC.ASSERT && keysLen!=keySerializer.valueArraySize(keys)) throw new AssertionError(); Object values; if((flags&DIR)!=0){ keysLen = keysLen - 1 + (flags>>2&1) +(flags>>1&1); long[] c = new long[keysLen]; values = c; input.unpackLongArray(c, 0, keysLen); }else{ values = valueSerializer.valueArrayDeserialize(input, keysLen - 2 + ((flags >>> 2) & 1) + ((flags >>> 1) & 1) + (flags & 1)); } Node ret = new Node(flags, link, keys, values); if(CC.PARANOID) ret.verifyNode(keySerializer, comparator, valueSerializer); return ret; }
@Override public int valueArrayBinarySearch(Long key, DataInput2 input, int keysLen, Comparator comparator) throws IOException { if (comparator != this) return super.valueArrayBinarySearch(key, input, keysLen, comparator); long key2 = key; for (int pos = 0; pos < keysLen; pos++) { long from = input.unpackLong(); if (key2 <= from) { input.unpackLongSkip(keysLen - pos - 1); return (key2 == from) ? pos : -(pos + 1); } } //not found return -(keysLen + 1); }
@Override public Long deserialize(DataInput2 in, int available) throws IOException { return new Long(in.unpackLong()); }
@Override public int valueArrayBinarySearch(Long key, DataInput2 input, int keysLen, Comparator comparator) throws IOException { if (comparator != this) return super.valueArrayBinarySearch(key, input, keysLen, comparator); long key2 = key; long from = 0; for (int pos = 0; pos < keysLen; pos++) { from += input.unpackLong(); if (key2 <= from) { input.unpackLongSkip(keysLen-pos-1); return (key2 == from) ? pos : -(pos + 1); } } //not found return -(keysLen + 1); }
@Override public Long deserialize(DataInput2 in, int available) throws IOException { return new Long(in.unpackLong()); }
input.unpackLong(); return input.unpackLong();
/** * Unpack RECID value from the input stream with 3 bit checksum. * * @param in The input stream. * @return The long value. * @throws java.io.IOException in case of IO error */ static public long unpackRecid(DataInput2 in) throws IOException { long val = in.unpackLong(); val = DataIO.parity1Get(val); return val >>> 1; }
input.unpackLong(); oldIndex += input.unpackLong(); long recid1 = input.unpackLong(); if(recid1 ==0) return 0L; //TODO this should not be here, if tree collapse exist oldIndex += input.unpackLong()-1;
private PartitionedEvent readPartitionedEvent(DataInput2 in) throws IOException { PartitionedEvent event = new PartitionedEvent(); event.setPartitionKey(in.unpackLong()); int partitionHashCode = in.unpackInt(); if (partitionHashCode != 0 && hashCodePartitionDict.containsKey(partitionHashCode)) { event.setPartition(hashCodePartitionDict.get(partitionHashCode)); } int eventBytesLen = in.unpackInt(); if (eventBytesLen > 0) { byte[] eventBytes = new byte[eventBytesLen]; in.readFully(eventBytes); event.setEvent((StreamEvent) SerializableUtils.deserializeFromCompressedByteArray(eventBytes, "Deserialize event from bytes")); } return event; }