List of usage examples for com.google.common.primitives Longs BYTES
int BYTES
To view the source code for com.google.common.primitives Longs BYTES.
Click Source Link
From source file:io.druid.query.aggregation.variance.VarianceAggregatorCollector.java
static int getMaxIntermediateSize() { return Longs.BYTES + Doubles.BYTES + Doubles.BYTES; }
From source file:tachyon.network.protocol.RPCBlockWriteRequest.java
@Override public int getEncodedLength() { // 4 longs (mSessionId, mBlockId, mOffset, mLength) return Longs.BYTES * 4; }
From source file:co.cask.cdap.data2.transaction.queue.QueueEntryRow.java
/** * @param stateValue value of the state column * @return state instance id//from w w w .j a v a 2s . c o m */ public static int getStateInstanceId(byte[] stateValue) { return Bytes.toInt(stateValue, Longs.BYTES, Ints.BYTES); }
From source file:com.yandex.yoctodb.util.UnsignedByteArrays.java
private static int compare(@NotNull final Buffer left, long leftFrom, final long leftLength, @NotNull final Buffer right, long rightFrom, final long rightLength) { assert leftLength > 0; assert rightLength > 0; // Adapted from Guava UnsignedBytes long length = Math.min(leftLength, rightLength); for (; length >= Longs.BYTES; leftFrom += Longs.BYTES, rightFrom += Longs.BYTES, length -= Longs.BYTES) { final long lw = left.getLong(leftFrom); final long rw = right.getLong(rightFrom); if (lw != rw) { return UnsignedLongs.compare(lw, rw); }// w w w. jav a 2s. c o m } if (length >= Ints.BYTES) { final int lw = left.getInt(leftFrom); final int rw = right.getInt(rightFrom); if (lw != rw) { return UnsignedInts.compare(lw, rw); } leftFrom += Ints.BYTES; rightFrom += Ints.BYTES; length -= Ints.BYTES; } for (; length > 0; leftFrom++, rightFrom++, length--) { final int result = UnsignedBytes.compare(left.get(leftFrom), right.get(rightFrom)); if (result != 0) { return result; } } return (leftLength < rightLength) ? -1 : ((leftLength == rightLength) ? 0 : 1); }
From source file:io.druid.query.filter.IntervalDimFilter.java
@Override public byte[] getCacheKey() { byte[] dimensionBytes = StringUtils.toUtf8(dimension); byte[] extractionFnBytes = extractionFn == null ? new byte[0] : extractionFn.getCacheKey(); int intervalsBytesSize = intervalLongs.size() * Longs.BYTES * 2 + intervalLongs.size(); ByteBuffer filterCacheKey = ByteBuffer .allocate(3 + dimensionBytes.length + intervalsBytesSize + extractionFnBytes.length) .put(DimFilterUtils.INTERVAL_CACHE_ID).put(dimensionBytes).put(DimFilterUtils.STRING_SEPARATOR) .put(extractionFnBytes).put(DimFilterUtils.STRING_SEPARATOR); for (Pair<Long, Long> interval : intervalLongs) { filterCacheKey.put(Longs.toByteArray(interval.lhs)).put(Longs.toByteArray(interval.rhs)) .put((byte) 0xFF); }/*from ww w. jav a 2 s . c o m*/ return filterCacheKey.array(); }
From source file:tachyon.network.protocol.RPCBlockResponse.java
@Override public int getEncodedLength() { // TODO: adjust the length when client also uses netty. // 3 longs (mBLockId, mOffset, mLength) + 1 short (DATA_SERVER_REQUEST_MESSAGE) return Longs.BYTES * 3 + Shorts.BYTES; }
From source file:io.druid.java.util.common.granularity.DurationGranularity.java
@Override public byte[] getCacheKey() { return ByteBuffer.allocate(2 * Longs.BYTES).putLong(duration).putLong(origin).array(); }
From source file:alluxio.network.protocol.RPCFileWriteResponse.java
@Override public int getEncodedLength() { // 3 longs (mTempUfsFileId, mOffset, mLength) + 1 short (mStatus) return Longs.BYTES * 3 + Shorts.BYTES; }
From source file:tachyon.network.protocol.RPCBlockWriteResponse.java
@Override public int getEncodedLength() { // 4 longs (mSessionId, mBlockId, mOffset, mLength) + 1 short (mStatus) return Longs.BYTES * 4 + Shorts.BYTES; }
From source file:co.cask.cdap.data2.transaction.queue.QueueEntryRow.java
/** * @param stateValue value of the state column * @return consumer entry state//from w w w . j a v a2 s . c om */ public static ConsumerEntryState getState(byte[] stateValue) { return ConsumerEntryState.fromState(stateValue[Longs.BYTES + Ints.BYTES]); }