@Override public DataOutput putInt(int val) { super.putInt(val); return this; }
@Override public DataOutput putLong(long val) { super.putLong(val); return this; }
@Override public StaticBuffer getStaticBuffer() { return getStaticBufferFlipBytes(0,0); }
public static StaticBuffer hashPrefixKey(final HashLength hashPrefixLen, final StaticBuffer key) { final int prefixLen = hashPrefixLen.length(); final StaticBuffer.Factory<HashCode> hashFactory; switch (hashPrefixLen) { case SHORT: hashFactory = SHORT_HASH_FACTORY; break; case LONG: hashFactory = LONG_HASH_FACTORY; break; default: throw new IllegalArgumentException("Unknown hash prefix: " + hashPrefixLen); } HashCode hashcode = key.as(hashFactory); WriteByteBuffer newKey = new WriteByteBuffer(prefixLen+key.length()); assert prefixLen==4 || prefixLen==8; if (prefixLen==4) newKey.putInt(hashcode.asInt()); else newKey.putLong(hashcode.asLong()); newKey.putBytes(key); return newKey.getStaticBuffer(); }
private StaticBuffer getBlockApplication(long blockValue, Instant timestamp) { WriteByteBuffer bb = new WriteByteBuffer( 8 // counter long + 8 // time in ms + uidBytes.length); bb.putLong(-blockValue).putLong(times.getTime(timestamp)); WriteBufferUtil.put(bb, uidBytes); return bb.getStaticBuffer(); }
public static StaticBuffer longToByteBuffer(long l) { return new WriteByteBuffer(8).putLong(l).getStaticBuffer(); }
public static Entry getEntry(int col, int val) { return new StaticArrayEntry(new WriteByteBuffer(4 * 2).putInt(col).putInt(val).getStaticBuffer(), 4); }
public static StaticBuffer getRelationType(long relationTypeId, DirectionID dirID, boolean invisible) { WriteBuffer b = new WriteByteBuffer(relationTypeLength(relationTypeId)); IDHandler.writeRelationType(b, relationTypeId, dirID, invisible); return b.getStaticBuffer(); }
@Override public DataOutput putBytes(final StaticBuffer val) { super.putBytes(val); return this; }
@Override public DataOutput putByte(byte val) { super.putByte(val); return this; }
@Override public DataOutput putChar(char val) { super.putChar(val); return this; }
@Override public DataOutput putDouble(double val) { super.putDouble(val); return this; }
@Override public WriteBuffer putBoolean(boolean val) { super.putBoolean(val); return this; }
private StaticBuffer[] getBlockSlice(long blockValue) { StaticBuffer[] slice = new StaticBuffer[2]; slice[0] = new WriteByteBuffer(16).putLong(-blockValue).putLong(0).getStaticBuffer(); slice[1] = new WriteByteBuffer(16).putLong(-blockValue).putLong(-1).getStaticBuffer(); return slice; }
public static StaticBuffer positiveBuffer(final long value) { WriteBuffer buffer = new WriteByteBuffer(positiveLength(value)); writePositive(buffer, value); return buffer.getStaticBuffer(); }
@Override public DataOutput putBytes(byte[] val) { super.putBytes(val); return this; }
@Override public WriteBuffer putBoolean(boolean val) { return putByte((byte)(val?1:0)); }
public static StaticBuffer positiveBuffer(long[] value) { int len = 0; for (long aValue : value) len += positiveLength(aValue); WriteBuffer buffer = new WriteByteBuffer(len); for (long aValue : value) writePositive(buffer, aValue); return buffer.getStaticBuffer(); }
public StaticBuffer toLockCol(Instant ts, StaticBuffer rid, TimestampProvider provider) { WriteBuffer b = new WriteByteBuffer(rid.length() + 8); b.putLong(provider.getTime(ts)); WriteBufferUtil.put(b, rid); return b.getStaticBuffer(); }
public StaticBuffer toLockKey(StaticBuffer key, StaticBuffer column) { WriteBuffer b = new WriteByteBuffer(key.length() + column.length() + 4); b.putInt(key.length()); WriteBufferUtil.put(b,key); WriteBufferUtil.put(b,column); return b.getStaticBuffer(); }