Interface ChunkedPacketHandler
- All Superinterfaces:
ChunkedPacketProvider
A handler for chunked packets parts. A handler is normally created through some kind of factory which decides which
handler should be used based on the supplied information by the network component trying to send the data into the
cluster. By default, the ChunkedPacketSessionOpenEvent is called and the handler set in the event will be used to
handle the full chunked data written by the other component.
A handler is not required to write the whole data the other component is sending. However, it is a good advise to not store the full data in the memory, as this is not the reason why the data is sent chunked to the current network component.
- Since:
- 4.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA callback called once the full data of the chunk session was received successfully. -
Method Summary
Modifier and TypeMethodDescriptionbooleanhandleChunkPart(int chunkPosition, @NonNull DataBuf dataBuf) Handles a part of chunked data which gets supplied to the current component.Methods inherited from interface eu.cloudnetservice.driver.network.chunk.ChunkedPacketProvider
sessionInformation, transferStatus
-
Method Details
-
handleChunkPart
Handles a part of chunked data which gets supplied to the current component. The data chunk is required to be from the same size as announced in the initial transfer information, unless the packet is the last packet of the chunked data stream.- Parameters:
chunkPosition- the position of the chunk, starting from 0.dataBuf- the data in the chunk.- Returns:
- true, if the chunk was the last chunk and the callback was called, false otherwise or in case of a failure.
- Throws:
NullPointerException- if the given data buf is null.
-