Example usage for com.google.common.primitives Longs toByteArray

List of usage examples for com.google.common.primitives Longs toByteArray

Introduction

In this page you can find the example usage for com.google.common.primitives Longs toByteArray.

Prototype

public static byte[] toByteArray(long value) 

Source Link

Document

Returns a big-endian representation of value in an 8-element byte array; equivalent to ByteBuffer.allocate(8).putLong(value).array() .

Usage

From source file:com.palantir.lock.AtlasTimestampLockDescriptor.java

/** Returns a {@code LockDescriptor} instance for the given table and row. */
public static LockDescriptor of(long timestamp) {
    return new LockDescriptor(Longs.toByteArray(timestamp));
}

From source file:org.wso2.mb.integration.common.utils.JMSClientHelper.java

/**
 * Return a different Xid each time this method is invoked
 *
 * @return Xid//ww w.  j  a  v  a2s  .  c o m
 */
public static Xid getNewXid() {
    return new TestXidImpl(100, Longs.toByteArray(GLOBAL_ID_GENERATOR.incrementAndGet()), new byte[] { 0x01 });
}

From source file:com.yandex.yoctodb.util.UnsignedByteArrays.java

@NotNull
public static UnsignedByteArray from(final long l) {
    return from(Longs.toByteArray(l ^ Long.MIN_VALUE));
}

From source file:suneido.database.immudb.DbGood.java

private static byte[] hash(long size) throws NoSuchAlgorithmException {
    MessageDigest md = MessageDigest.getInstance("SHA-1");
    md.update(Longs.toByteArray(size));
    return md.digest();
}

From source file:de.brands4friends.daleq.core.Base64TemplateValue.java

@Override
public Object transform(final long value) {
    return Base64.encodeBase64String(Longs.toByteArray(value));
}

From source file:org.apache.flume.event.EventBuilder.java

public static Event withBody(long body) {
    Map<String, String> headers = Maps.newHashMap();
    headers.put(Event.bodyType, "long");
    return withBody(Longs.toByteArray(body), headers);
}

From source file:co.paralleluniverse.common.io.Hasher.java

@Override
public byte[] getChecksum() {
    return Longs.toByteArray(value);
}

From source file:org.opendedup.collections.InsertRecord.java

public InsertRecord(boolean inserted, long pos) {
    this.inserted = inserted;
    this.hashlocs = Longs.toByteArray(pos);
}

From source file:com.prealpha.minelib.nbt.LongTag.java

@Override
public ByteBuffer toBytes() {
    return ByteBuffer.wrap(Longs.toByteArray(value));
}

From source file:com.palantir.atlasdb.encoding.PtBytes.java

/**
 * Convert a long value to a byte array using big-endian.
 *///from  ww w .j a v  a 2 s. c  o  m
public static byte[] toBytes(long val) {
    return Longs.toByteArray(val);
}