1 18 package org.apache.activemq.store.kahadaptor; 19 20 import java.io.DataInput ; 21 import java.io.DataOutput ; 22 import java.io.IOException ; 23 import org.apache.activemq.kaha.Marshaller; 24 import org.apache.activemq.kaha.impl.index.IndexItem; 25 26 27 31 public class TopicSubAckMarshaller implements Marshaller{ 32 33 34 public void writePayload(Object object,DataOutput dataOut) throws IOException { 35 TopicSubAck tsa = (TopicSubAck) object; 36 dataOut.writeInt(tsa.getCount()); 37 IndexItem item = (IndexItem)tsa.getMessageEntry(); 38 dataOut.writeLong(item.getOffset()); 39 item.write(dataOut); 40 41 } 42 43 public Object readPayload(DataInput dataIn) throws IOException { 44 TopicSubAck tsa = new TopicSubAck(); 45 int count = dataIn.readInt(); 46 tsa.setCount(count); 47 IndexItem item = new IndexItem(); 48 item.setOffset(dataIn.readLong()); 49 item.read(dataIn); 50 tsa.setMessageEntry(item); 51 return tsa; 52 } 53 } 54 | Popular Tags |