public class NDArrayMessageChunk extends Object implements Serializable
NDArrayMessagethat needs to be reassembled. This chunking is for large messages that need to be segmented to be sent over the wire. An
AeronNDArraySubscriberwould use this information to assemble a contiguous buffer to be used for assembling a large
NDArrayMessageOf note is that this chunk will also contain the needed data for assembling in addition to the desired metadata such as the chunk size. A chunk has an idea which is used to track the chunk across fragmentations, an index fr determining ordering for re assembling, and metadata about the chunk such as the chunk size and number of chunks
|Constructor and Description|
|Modifier and Type||Method and Description|
Returns a chunk given the passed in
Returns the overall size for an
Convert an ndarray message chunk to a buffer.
public static int sizeForMessage(NDArrayMessageChunk chunk)
NDArrayMessageChunk. The size of a message chunk is: idLengthSize(4) + messageTypeSize(4) + indexSize(4) + chunkSizeSize(4) + numChunksSize(4) + chunk.getData().limit() + chunk.getId().getBytes().length Many of these are flat out integers and are mainly variables for accounting purposes and ease of readbility
public static ByteBuffer toBuffer(NDArrayMessageChunk chunk)
chunk- the chunk to convert
ByteBufferbased on the passed in message chunk.
public static NDArrayMessageChunk fromBuffer(ByteBuffer byteBuffer, NDArrayMessage.MessageType type)
ByteBufferNOTE THAT THIS WILL MODIFY THE PASSED IN BYTEBUFFER's POSITION.
byteBuffer- the byte buffer to extract the chunk from
Copyright © 2020. All rights reserved.