1 18 19 package org.apache.activemq.openwire.v2; 20 21 import java.io.DataInput ; 22 import java.io.DataOutput ; 23 import java.io.IOException ; 24 25 import org.apache.activemq.openwire.*; 26 import org.apache.activemq.command.*; 27 28 29 30 41 public abstract class BaseCommandMarshaller extends BaseDataStreamMarshaller { 42 43 50 public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { 51 super.tightUnmarshal(wireFormat, o, dataIn, bs); 52 53 BaseCommand info = (BaseCommand)o; 54 info.setCommandId(dataIn.readInt()); 55 info.setResponseRequired(bs.readBoolean()); 56 57 } 58 59 60 63 public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { 64 65 BaseCommand info = (BaseCommand)o; 66 67 int rc = super.tightMarshal1(wireFormat, o, bs); 68 bs.writeBoolean(info.isResponseRequired()); 69 70 return rc + 4; 71 } 72 73 80 public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { 81 super.tightMarshal2(wireFormat, o, dataOut, bs); 82 83 BaseCommand info = (BaseCommand)o; 84 dataOut.writeInt(info.getCommandId()); 85 bs.readBoolean(); 86 87 } 88 89 96 public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { 97 super.looseUnmarshal(wireFormat, o, dataIn); 98 99 BaseCommand info = (BaseCommand)o; 100 info.setCommandId(dataIn.readInt()); 101 info.setResponseRequired(dataIn.readBoolean()); 102 103 } 104 105 106 109 public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { 110 111 BaseCommand info = (BaseCommand)o; 112 113 super.looseMarshal(wireFormat, o, dataOut); 114 dataOut.writeInt(info.getCommandId()); 115 dataOut.writeBoolean(info.isResponseRequired()); 116 117 } 118 } 119 | Popular Tags |