1 18 19 package org.apache.activemq.openwire.v3; 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 class ConsumerIdMarshaller extends BaseDataStreamMarshaller { 42 43 47 public byte getDataStructureType() { 48 return ConsumerId.DATA_STRUCTURE_TYPE; 49 } 50 51 54 public DataStructure createObject() { 55 return new ConsumerId(); 56 } 57 58 65 public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { 66 super.tightUnmarshal(wireFormat, o, dataIn, bs); 67 68 ConsumerId info = (ConsumerId)o; 69 info.setConnectionId(tightUnmarshalString(dataIn, bs)); 70 info.setSessionId(tightUnmarshalLong(wireFormat, dataIn, bs)); 71 info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs)); 72 73 } 74 75 76 79 public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { 80 81 ConsumerId info = (ConsumerId)o; 82 83 int rc = super.tightMarshal1(wireFormat, o, bs); 84 rc += tightMarshalString1(info.getConnectionId(), bs); 85 rc+=tightMarshalLong1(wireFormat, info.getSessionId(), bs); 86 rc+=tightMarshalLong1(wireFormat, info.getValue(), bs); 87 88 return rc + 0; 89 } 90 91 98 public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { 99 super.tightMarshal2(wireFormat, o, dataOut, bs); 100 101 ConsumerId info = (ConsumerId)o; 102 tightMarshalString2(info.getConnectionId(), dataOut, bs); 103 tightMarshalLong2(wireFormat, info.getSessionId(), dataOut, bs); 104 tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs); 105 106 } 107 108 115 public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { 116 super.looseUnmarshal(wireFormat, o, dataIn); 117 118 ConsumerId info = (ConsumerId)o; 119 info.setConnectionId(looseUnmarshalString(dataIn)); 120 info.setSessionId(looseUnmarshalLong(wireFormat, dataIn)); 121 info.setValue(looseUnmarshalLong(wireFormat, dataIn)); 122 123 } 124 125 126 129 public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { 130 131 ConsumerId info = (ConsumerId)o; 132 133 super.looseMarshal(wireFormat, o, dataOut); 134 looseMarshalString(info.getConnectionId(), dataOut); 135 looseMarshalLong(wireFormat, info.getSessionId(), dataOut); 136 looseMarshalLong(wireFormat, info.getValue(), dataOut); 137 138 } 139 } 140 | Popular Tags |