1 18 package org.apache.activemq.kaha; 19 20 import java.io.DataInput ; 21 import java.io.DataOutput ; 22 import java.io.IOException ; 23 28 public class BytesMarshaller implements Marshaller{ 29 36 public void writePayload(Object object,DataOutput dataOut) throws IOException { 37 byte[] data=(byte[]) object; 38 dataOut.writeInt(data.length); 39 dataOut.write(data); 40 } 41 42 49 public Object readPayload(DataInput dataIn) throws IOException { 50 int size=dataIn.readInt(); 51 byte[] data=new byte[size]; 52 dataIn.readFully(data); 53 return data; 54 } 55 } 56 | Popular Tags |