接口的使用
java.lang.foreign.ValueLayout.OfByte
-
ValueLayout.OfByte 的用法PREVIEW 在java.lang.foreign
修饰符和类型Field描述static final ValueLayout.OfBytePREVIEWValueLayout.JAVA_BYTE一个值布局常量,其大小与 Javabyte的大小相同,位对齐设置为 8,字节顺序设置为ByteOrder.nativeOrder()。修饰符和类型方法描述ValueLayout.OfByte.withBitAlignment(long bitAlignment) 返回与此布局具有相同大小和名称但具有指定对齐约束(以位为单位)的相同类型的内存布局。返回与此布局具有相同大小和对齐约束但具有指定名称的相同类型的内存布局。返回与此值布局具有相同载体、对齐约束和名称但具有指定字节顺序的值布局。java.lang.foreign 中的方法,参数类型为 ValueLayout.OfBytePREVIEW修饰符和类型方法描述default MemorySegmentPREVIEWSegmentAllocator.allocate(ValueLayout.OfBytePREVIEW layout, byte value) 分配具有给定布局的内存段,并使用给定的字节值对其进行初始化。default MemorySegmentPREVIEWSegmentAllocator.allocateArray(ValueLayout.OfBytePREVIEW elementLayout, byte... elements) 分配具有给定布局的内存段,并使用给定的字节元素对其进行初始化。default byteMemorySegment.get(ValueLayout.OfBytePREVIEW layout, long offset) 使用给定布局从给定偏移量处的该段中读取一个字节。default voidMemorySegment.set(ValueLayout.OfBytePREVIEW layout, long offset, byte value) 使用给定的布局在给定的偏移量处将一个字节写入该段。byte[]MemorySegment.toArray(ValueLayout.OfBytePREVIEW elementLayout) 将此内存段的内容复制到一个新的字节数组中。