public class Packet extends Object implements Serializable, Cloneable
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
keepConnection |
| Constructor and Description |
|---|
Packet() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearZeroCopy()
清除零拷贝传输设置
|
Packet |
clone() |
int |
getByteCount() |
Long |
getId() |
PacketMeta |
getMeta() |
ByteBuffer |
getPreEncodedByteBuffer() |
Long |
getRespId() |
Integer |
getSynSeq() |
FileChannel |
getZeroCopyFileChannel()
返回零拷贝传输使用的 FileChannel 对象
|
long |
getZeroCopyFileLength()
返回零拷贝传输的数据长度
|
boolean |
isBlockSend() |
boolean |
isFromCluster() |
boolean |
isKeepConnection() |
boolean |
isSslEncrypted() |
boolean |
isZeroCopy()
是否启用了零拷贝传输
|
String |
logstr() |
void |
setBlockSend(boolean isBlockSend) |
void |
setByteCount(int byteCount) |
void |
setFromCluster(boolean isFromCluster) |
void |
setId(Long id) |
void |
setKeepConnection(boolean keepedConnection) |
void |
setMeta(PacketMeta meta) |
void |
setPreEncodedByteBuffer(ByteBuffer preEncodedByteBuffer) |
void |
setRespId(Long respId) |
void |
setSslEncrypted(boolean isSslEncrypted) |
void |
setSynSeq(Integer synSeq) |
void |
setZeroCopy(FileChannel fileChannel,
long fileLength)
设置零拷贝传输数据。调用后,Packet 将使用指定的 FileChannel 以及文件长度进行零拷贝传输,
发送时框架需要检测 isZeroCopy() 为 true 时使用底层的零拷贝方法。
|
public void setKeepConnection(boolean keepedConnection)
public boolean isKeepConnection()
public int getByteCount()
public Long getId()
public ByteBuffer getPreEncodedByteBuffer()
public Long getRespId()
public Integer getSynSeq()
public boolean isBlockSend()
public String logstr()
public void setBlockSend(boolean isBlockSend)
public void setByteCount(int byteCount)
public void setId(Long id)
public void setPreEncodedByteBuffer(ByteBuffer preEncodedByteBuffer)
public void setRespId(Long respId)
public void setSynSeq(Integer synSeq)
public boolean isFromCluster()
public void setFromCluster(boolean isFromCluster)
public boolean isSslEncrypted()
public void setSslEncrypted(boolean isSslEncrypted)
public PacketMeta getMeta()
public void setMeta(PacketMeta meta)
public void setZeroCopy(FileChannel fileChannel, long fileLength)
fileChannel - 零拷贝传输使用的文件通道fileLength - 传输数据的长度public boolean isZeroCopy()
public FileChannel getZeroCopyFileChannel()
public long getZeroCopyFileLength()
public void clearZeroCopy()
Copyright © 2025. All rights reserved.