Why ByteBuffer doesn't provide method to read write boolean data type

ban*_*ara 2 java nio

Why ByteBuffer class doesn't provide method to read write boolean data type, is there any workaround?

Kay*_*man 5

Boolean是1位数据类型.ByteBuffer适用于字节.您必须自己决定如何将布尔值表示为一个字节(例如0表示false,1表示true,0表示false,非0表示true).