java - 比较 ByteBuffer 的内容?

标签 java bytebuffer

在 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/

相关文章:

java - JodConverter 错误 officeHome 未设置且无法自动检测

java.util.ArrayList 无法转换为 bean.Book

java - 从 ByteBuffer 读取前四个字节,然后将它们写回?

java - 在 ByteBuffer 中写入混合数据类型

java - 在java中使用堆栈解决迷宫

java - 如何将 Hibernate SQLQuery 结果转换为 JSON

java - 列表<? extends Object>#add(new MyClass()) 不编译

android - outputBuffers 返回空指针,尽管帧在屏幕上呈现,在 Android 中使用 MediaCodec

java - ByteBuffer getInt() 问题

Java 字节缓冲区类