|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Represents an object used to pass data to be persisted across the
MqttClientPersistence
interface.
When data is passed across the interface the header and payload are separated, so that unnecessary message copies may be avoided. For example, if a 10 MB payload was published it would be inefficient to create a byte array a few bytes larger than 10 MB and copy the MQTT message header and payload into a contiguous byte array.
When the request to persist data is made a separate byte array and offset is passed for the header and payload. Only the data between offset and length need be persisted. So for example, a message to be persisted consists of a header byte array starting at offset 1 and length 4, plus a payload byte array starting at offset 30 and length 40000. There are three ways in which the persistence implementation may return data to the client on recovery:
Method Summary | |
---|---|
byte[] |
getHeaderBytes()
Returns the header bytes in an array. |
int |
getHeaderLength()
Returns the length of the header. |
int |
getHeaderOffset()
Returns the offset of the header within the byte array returned by getHeaderBytes() . |
byte[] |
getPayloadBytes()
Returns the payload bytes in an array. |
int |
getPayloadLength()
Returns the length of the payload. |
int |
getPayloadOffset()
Returns the offset of the payload within the byte array returned by getPayloadBytes() . |
Method Detail |
public byte[] getHeaderBytes() throws MqttPersistenceException
getHeaderOffset()
and continue for getHeaderLength()
.
MqttPersistenceException
public int getHeaderLength() throws MqttPersistenceException
MqttPersistenceException
public int getHeaderOffset() throws MqttPersistenceException
getHeaderBytes()
.
MqttPersistenceException
public byte[] getPayloadBytes() throws MqttPersistenceException
getPayloadOffset()
and continue for getPayloadLength()
.
MqttPersistenceException
public int getPayloadLength() throws MqttPersistenceException
MqttPersistenceException
public int getPayloadOffset() throws MqttPersistenceException
getPayloadBytes()
.
MqttPersistenceException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |