[UE4]BufferBuilder in Unreal
Keywords: UE4, BufferBuilder in Unreal
Q: Is there a class equals BufferBuilder
of Java in Unreal?
A: FBufferArchive
FBufferArchive
:
Engine\Source\Runtime\Core\Public\Serialization\BufferArchive.h
FBufferReader
:
Engine\Source\Runtime\Core\Public\Serialization\BufferReader.h
FBufferWriter
:
Engine\Source\Runtime\Core\Public\Serialization\BufferWriter.h
Example:
StreamHandle.h
TQueue<TUniquePtr<FBufferWriter>, EQueueMode::Spsc> RecvQueue;
StreamHandle.cpp
void StreamHandle::Recv(uint8* Stream, int32 Len)
{
const int32 BuffLen = 1024 * 1024;
if(Len <= BuffLen)
{
void* Data = FMemory::Malloc(BuffLen);
TUniquePtr<FBufferWriter> Buffer = MakeUnique<FBufferWriter>(Data, BuffLen);
Buffer->Serialize(Stream, Len);
RecvQueue.Enqueue(MoveTemp(Buffer));
}
}
To a man whose mind is free there is something even more intolerable in the sufferings of animals than in the sufferings of man. For with the latter it is at least admitted that suffering is evil and that the man who causes it is a criminal. But thousands of animals are uselessly butchered every day without a shadow of remorse. If any man were to refer to it, he would be thought ridiculous. And that is the unpardonable crime. ― Romain Rolland