gpt4 book ai didi

java - 比较 ByteBuffer 的内容?

转载 作者:搜寻专家 更新时间:2023-10-30 21:25:15 24 4
gpt4 key购买 nike

在 Java 中比较两个 ByteBuffer 的内容以检查是否相等的最简单方法是什么?

最佳答案

您可以检查 equals()方法也是。

Tells whether or not this buffer is equal to another object.

Two byte buffers are equal if, and only if,

  1. They have the same element type,
  2. They have the same number of remaining elements, and
  3. The two sequences of remaining elements, considered independently of their starting positions, are pointwise equal.

A byte buffer is not equal to any other type of object.

关于java - 比较 ByteBuffer 的内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3769891/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com