Record Class ChunkedFileProcessor.Chunk
java.lang.Object
java.lang.Record
cloud.opencode.base.io.file.ChunkedFileProcessor.Chunk
- Record Components:
index- the chunk index (0-based) - 块索引(从0开始)offset- the byte offset in the file - 文件中的字节偏移data- the chunk data - 块数据size- the actual data size (may be less than data.length for last chunk) - 实际数据大小isLast- whether this is the last chunk - 是否是最后一块
- Enclosing class:
ChunkedFileProcessor
public static record ChunkedFileProcessor.Chunk(long index, long offset, byte[] data, int size, boolean isLast)
extends Record
Represents a chunk of file data.
表示文件数据块。
- Since:
- JDK 25, opencode-base-io V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
ConstructorsConstructorDescriptionChunk(long index, long offset, byte[] data, int size, boolean isLast) Compact constructor - defensive copy of mutable byte array. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]bytes()Gets the actual data as a trimmed byte array.byte[]data()Returns the value of thedatarecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longindex()Returns the value of theindexrecord component.booleanisLast()Returns the value of theisLastrecord component.longoffset()Returns the value of theoffsetrecord component.intsize()Returns the value of thesizerecord component.Gets a read-only ByteBuffer view of the data.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Chunk
public Chunk(long index, long offset, byte[] data, int size, boolean isLast) Compact constructor - defensive copy of mutable byte array. 紧凑构造器 - 可变字节数组的防御性复制。
-
-
Method Details
-
toByteBuffer
Gets a read-only ByteBuffer view of the data. 获取数据的只读ByteBuffer视图。- Returns:
- a read-only ByteBuffer - 只读ByteBuffer
-
bytes
public byte[] bytes()Gets the actual data as a trimmed byte array. 获取修剪后的实际数据字节数组。- Returns:
- the data bytes - 数据字节
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
index
-
offset
-
data
-
size
-
isLast
-