more code
[iotcloud.git] / src / java / iotcloud / LastMessage.java
1 package iotcloud;
2
3 import java.nio.ByteBuffer;
4
5 class LastMessage extends Entry {
6         private long machineid;
7         private long seqnum;
8         
9         LastMessage(long _machineid, long _seqnum) {
10                 machineid=_machineid;
11                 seqnum=_seqnum;
12         }
13
14         static Entry decode(ByteBuffer bb) {
15                 long machineid=bb.getLong();
16                 long seqnum=bb.getLong();
17                 return new LastMessage(machineid, seqnum);
18         }
19
20         void encode(ByteBuffer bb) {
21                 bb.put(Entry.TypeLastMessage);
22                 bb.putLong(machineid);
23                 bb.putLong(seqnum);
24         }
25         
26         int getSize() {
27                 return 2*Long.BYTES+Byte.BYTES;
28         }
29
30         byte getType() {
31                 return Entry.TypeLastMessage;
32         }
33 }
34
35