com.eaio.uuid.UUID.getClockSeqAndNode()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中com.eaio.uuid.UUID.getClockSeqAndNode()方法的一些代码示例,展示了UUID.getClockSeqAndNode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UUID.getClockSeqAndNode()方法的具体详情如下:
包路径:com.eaio.uuid.UUID
类名称:UUID
方法名:getClockSeqAndNode

UUID.getClockSeqAndNode介绍

[英]Returns the clock and node field of the UUID (lower 64 bits).
[中]返回UUID的时钟和节点字段(低64位)。

代码示例

代码示例来源:origin: Graylog2/graylog2-server

public byte[] getIdBytes() {
  final long time = id.getTime();
  final long clockSeqAndNode = id.getClockSeqAndNode();
  return ByteBuffer.allocate(16)
      .putLong(time)
      .putLong(clockSeqAndNode)
      .array(); // TODO PERFORMANCE object creation
}

代码示例来源:origin: hector-client/hector

@Override
public ByteBuffer toByteBuffer(UUID uuid) {
 if (uuid == null) {
  return null;
 }
 long msb = uuid.getTime();
 long lsb = uuid.getClockSeqAndNode();
 byte[] buffer = new byte[16];
 for (int i = 0; i < 8; i++) {
  buffer[i] = (byte) (msb >>> 8 * (7 - i));
 }
 for (int i = 8; i < 16; i++) {
  buffer[i] = (byte) (lsb >>> 8 * (7 - i));
 }
 return ByteBuffer.wrap(buffer);
}

代码示例来源:origin: org.graylog2/graylog2-server

public byte[] getIdBytes() {
  final long time = id.getTime();
  final long clockSeqAndNode = id.getClockSeqAndNode();
  return ByteBuffer.allocate(16)
      .putLong(time)
      .putLong(clockSeqAndNode)
      .array(); // TODO PERFORMANCE object creation
}

代码示例来源:origin: org.hectorclient/hector-core

@Override
public ByteBuffer toByteBuffer(UUID uuid) {
 if (uuid == null) {
  return null;
 }
 long msb = uuid.getTime();
 long lsb = uuid.getClockSeqAndNode();
 byte[] buffer = new byte[16];
 for (int i = 0; i < 8; i++) {
  buffer[i] = (byte) (msb >>> 8 * (7 - i));
 }
 for (int i = 8; i < 16; i++) {
  buffer[i] = (byte) (lsb >>> 8 * (7 - i));
 }
 return ByteBuffer.wrap(buffer);
}

代码示例来源:origin: riptano/hector-jpa

public ByteBuffer toByteBuffer(UUID uuid) {
 if (uuid == null) {
  return null;
 }
 long msb = uuid.getTime();
 long lsb = uuid.getClockSeqAndNode();
 
 byte[] buffer = new byte[16];
 for (int i = 0; i < 8; i++) {
  buffer[i] = (byte) (msb >>> 8 * (7 - i));
 }
 for (int i = 8; i < 16; i++) {
  buffer[i] = (byte) (lsb >>> 8 * (7 - i));
 }
 return ByteBuffer.wrap(buffer);
}

代码示例来源:origin: me.prettyprint/hector-core

@Override
public ByteBuffer toByteBuffer(UUID uuid) {
 if (uuid == null) {
  return null;
 }
 long msb = uuid.getTime();
 long lsb = uuid.getClockSeqAndNode();
 byte[] buffer = new byte[16];
 for (int i = 0; i < 8; i++) {
  buffer[i] = (byte) (msb >>> 8 * (7 - i));
 }
 for (int i = 8; i < 16; i++) {
  buffer[i] = (byte) (lsb >>> 8 * (7 - i));
 }
 return ByteBuffer.wrap(buffer);
}

代码示例来源:origin: perfectsense/dari

/**
   * Creates a time-based version 1 UUID.
   *
   * <p>To use this method, it must be able to access a special
   * <a href="http://johannburkard.de/software/uuid/">UUID library</a>.
   * If you use Maven, you should add the following dependency:</p>
   *
   * <blockquote><pre><code data-type="xml">{@literal
   *<dependency>
   *    <groupId>com.eaio.uuid</groupId>
   *    <artifactId>uuid</artifactId>
   *    <version>3.2</version>
   *</dependency>}</code></pre></blockquote>
   *
   * @deprecated Use the UUID library directy.
   */
  @Deprecated
  public static UUID createVersion1Uuid() {
    com.eaio.uuid.UUID uuid = new com.eaio.uuid.UUID();
    return new UUID(uuid.getTime(), uuid.getClockSeqAndNode());
  }
}

相关文章