java.nio.ByteBuffer.compareTo()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(180)

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

ByteBuffer.compareTo介绍

[英]Compares the remaining bytes of this buffer to another byte buffer's remaining bytes.
[中]将此缓冲区的剩余字节与另一个字节缓冲区的剩余字节进行比较。

代码示例

代码示例来源:origin: redisson/redisson

@Override
public int compareTo(Buffer buffer) {
  return (null != buffer ? this.buffer.compareTo(buffer.buffer) : -1);
}

代码示例来源:origin: apache/incubator-druid

@Override
public int compareTo(ImmutableRTree other)
{
 return this.data.compareTo(other.data);
}

代码示例来源:origin: thinkaurelius/titan

@Override
  public int compareTo(ByteEntry byteEntry) {
    return key.compareTo(byteEntry.key);
  }
}

代码示例来源:origin: JanusGraph/janusgraph

@Override
  public int compareTo(ByteEntry byteEntry) {
    return key.compareTo(byteEntry.key);
  }
}

代码示例来源:origin: apache/incubator-druid

@Override
public int compareTo(VSizeColumnarInts o)
{
 int retVal = Ints.compare(numBytes, o.numBytes);
 if (retVal == 0) {
  retVal = buffer.compareTo(o.buffer);
 }
 return retVal;
}

代码示例来源:origin: tjake/Solandra

if (c.timestamp() == minTtl && winningToken.compareTo(c.name()) <= 0)

代码示例来源:origin: apache/hbase

Bytes.toString(Bytes.toBytes(previous)));
assertTrue(key.compareTo(bbMidkeyBytes) < 0);

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

@Override
public int compareTo(AbstractComposite o) {
 return serialize().compareTo(o.serialize());
}

代码示例来源:origin: com.stratio.cassandra/cassandra-driver-core

@Override
public int compareTo(Token other) {
  assert other instanceof OPPToken;
  return value.compareTo(((OPPToken)other).value);
}

代码示例来源:origin: com.bazaarvoice.astyanax/astyanax-thrift

public int compareTo(Object obj) {
  if (obj instanceof KeyAndColumnFamily) {
    KeyAndColumnFamily other = (KeyAndColumnFamily)obj;
    int result = columnFamily.compareTo(other.columnFamily);
    if (result == 0) {
      result = key.compareTo(other.key);
    }
    return result;
  }
  return -1;
}

代码示例来源:origin: eventsourcing/es4j

@Override public int compareTo(Object o) {
    if (!(o instanceof byte[])) {
      return -1;
    }
    return ByteBuffer.wrap(bytes).compareTo(ByteBuffer.wrap((byte[]) o));
  }
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

public int compare(InetAddress o1, InetAddress o2)
  {
    return ByteBuffer.wrap(o1.getAddress()).compareTo(ByteBuffer.wrap(o2.getAddress()));
  }
};

代码示例来源:origin: org.apache.cassandra/cassandra-all

public int compare(InetAddress o1, InetAddress o2)
  {
    return ByteBuffer.wrap(o1.getAddress()).compareTo(ByteBuffer.wrap(o2.getAddress()));
  }
};

代码示例来源:origin: jsevellec/cassandra-unit

public int compare(InetAddress o1, InetAddress o2)
  {
    return ByteBuffer.wrap(o1.getAddress()).compareTo(ByteBuffer.wrap(o2.getAddress()));
  }
};

代码示例来源:origin: opendedup/sdfs

public static void main(String[] args) {
  ByteBuffer kbf = ByteBuffer.allocateDirect(16);
  ByteBuffer zbf = ByteBuffer.allocateDirect(16);
  zbf.putLong(16);
  zbf.putLong(16);
  kbf.putLong(16);
  kbf.putLong(16);
  zbf.position(0);
  kbf.position(0);
  System.out.println(kbf.compareTo(zbf));
}

代码示例来源:origin: opendedup/sdfs

public static void main(String [] args) {
  ByteBuffer bf = ByteBuffer.allocateDirect(16);
  ByteBuffer zbf = ByteBuffer.allocateDirect(16);
  zbf.putLong(16);
  zbf.putLong(16);
  bf.putLong(16);
  bf.putLong(16);
  zbf.position(0);
  bf.position(0);
  System.out.println(bf.compareTo(zbf));
}

代码示例来源:origin: org.onosproject/onos-protocols-bgp-bgpio

@Override
public int compareTo(Object o) {
  if (this.equals(o)) {
    return 0;
  }
  ByteBuffer value1 = ByteBuffer.wrap(this.isoNodeID);
  ByteBuffer value2 = ByteBuffer.wrap(((IsIsNonPseudonode) o).isoNodeID);
  return value1.compareTo(value2);
}

代码示例来源:origin: com.n3twork.druid/druid-processing

@Override
public int compareTo(VSizeIndexedInts o)
{
 int retVal = Ints.compare(numBytes, o.numBytes);
 if (retVal == 0) {
  retVal = buffer.compareTo(o.buffer);
 }
 
 return retVal;    
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

@Override
  public int compare(ColumnDefinition column, ColumnDefinition otherColumn)
  {
    int value = Integer.compare(column.position(), otherColumn.position());
    return value != 0 ? value : column.name.bytes.compareTo(otherColumn.name.bytes);
  }
};

代码示例来源:origin: com.n3twork.druid/druid-processing

@Override
 public int compare(
   HyperLogLogCollector arg1, HyperLogLogCollector arg2
 )
 {
  return arg1.toByteBuffer().compareTo(arg2.toByteBuffer());
 }
}.nullsFirst();

相关文章