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 IntegerResponseMarshaller extends ResponseMarshaller { 42 43 47 public byte getDataStructureType() { 48 return IntegerResponse.DATA_STRUCTURE_TYPE; 49 } 50 51 54 public DataStructure createObject() { 55 return new IntegerResponse(); 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 IntegerResponse info = (IntegerResponse)o; 69 info.setResult(dataIn.readInt()); 70 71 } 72 73 74 77 public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { 78 79 IntegerResponse info = (IntegerResponse)o; 80 81 int rc = super.tightMarshal1(wireFormat, o, bs); 82 83 return rc + 4; 84 } 85 86 93 public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { 94 super.tightMarshal2(wireFormat, o, dataOut, bs); 95 96 IntegerResponse info = (IntegerResponse)o; 97 dataOut.writeInt(info.getResult()); 98 99 } 100 101 108 public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { 109 super.looseUnmarshal(wireFormat, o, dataIn); 110 111 IntegerResponse info = (IntegerResponse)o; 112 info.setResult(dataIn.readInt()); 113 114 } 115 116 117 120 public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { 121 122 IntegerResponse info = (IntegerResponse)o; 123 124 super.looseMarshal(wireFormat, o, dataOut); 125 dataOut.writeInt(info.getResult()); 126 127 } 128 } 129 | Popular Tags |