1 18 19 package org.apache.activemq.openwire.v1; 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 WireFormatInfoMarshaller extends BaseDataStreamMarshaller { 42 43 47 public byte getDataStructureType() { 48 return WireFormatInfo.DATA_STRUCTURE_TYPE; 49 } 50 51 54 public DataStructure createObject() { 55 return new WireFormatInfo(); 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 WireFormatInfo info = (WireFormatInfo)o; 69 70 info.beforeUnmarshall(wireFormat); 71 72 info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8)); 73 info.setVersion(dataIn.readInt()); 74 info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs)); 75 76 info.afterUnmarshall(wireFormat); 77 78 } 79 80 81 84 public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { 85 86 WireFormatInfo info = (WireFormatInfo)o; 87 88 info.beforeMarshall(wireFormat); 89 90 int rc = super.tightMarshal1(wireFormat, o, bs); 91 rc += tightMarshalConstByteArray1(info.getMagic(), bs, 8); 92 rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs); 93 94 return rc + 4; 95 } 96 97 104 public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { 105 super.tightMarshal2(wireFormat, o, dataOut, bs); 106 107 WireFormatInfo info = (WireFormatInfo)o; 108 tightMarshalConstByteArray2(info.getMagic(), dataOut, bs, 8); 109 dataOut.writeInt(info.getVersion()); 110 tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs); 111 112 info.afterMarshall(wireFormat); 113 114 } 115 116 123 public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { 124 super.looseUnmarshal(wireFormat, o, dataIn); 125 126 WireFormatInfo info = (WireFormatInfo)o; 127 128 info.beforeUnmarshall(wireFormat); 129 130 info.setMagic(looseUnmarshalConstByteArray(dataIn, 8)); 131 info.setVersion(dataIn.readInt()); 132 info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn)); 133 134 info.afterUnmarshall(wireFormat); 135 136 } 137 138 139 142 public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { 143 144 WireFormatInfo info = (WireFormatInfo)o; 145 146 info.beforeMarshall(wireFormat); 147 148 super.looseMarshal(wireFormat, o, dataOut); 149 looseMarshalConstByteArray(wireFormat, info.getMagic(), dataOut, 8); 150 dataOut.writeInt(info.getVersion()); 151 looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut); 152 153 } 154 } 155 | Popular Tags |