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 DataArrayResponseMarshaller extends ResponseMarshaller { 42 43 47 public byte getDataStructureType() { 48 return DataArrayResponse.DATA_STRUCTURE_TYPE; 49 } 50 51 54 public DataStructure createObject() { 55 return new DataArrayResponse(); 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 DataArrayResponse info = (DataArrayResponse)o; 69 70 if (bs.readBoolean()) { 71 short size = dataIn.readShort(); 72 org.apache.activemq.command.DataStructure value[] = new org.apache.activemq.command.DataStructure[size]; 73 for( int i=0; i < size; i++ ) { 74 value[i] = (org.apache.activemq.command.DataStructure) tightUnmarsalNestedObject(wireFormat,dataIn, bs); 75 } 76 info.setData(value); 77 } 78 else { 79 info.setData(null); 80 } 81 82 } 83 84 85 88 public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { 89 90 DataArrayResponse info = (DataArrayResponse)o; 91 92 int rc = super.tightMarshal1(wireFormat, o, bs); 93 rc += tightMarshalObjectArray1(wireFormat, info.getData(), bs); 94 95 return rc + 0; 96 } 97 98 105 public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { 106 super.tightMarshal2(wireFormat, o, dataOut, bs); 107 108 DataArrayResponse info = (DataArrayResponse)o; 109 tightMarshalObjectArray2(wireFormat, info.getData(), dataOut, bs); 110 111 } 112 113 120 public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { 121 super.looseUnmarshal(wireFormat, o, dataIn); 122 123 DataArrayResponse info = (DataArrayResponse)o; 124 125 if (dataIn.readBoolean()) { 126 short size = dataIn.readShort(); 127 org.apache.activemq.command.DataStructure value[] = new org.apache.activemq.command.DataStructure[size]; 128 for( int i=0; i < size; i++ ) { 129 value[i] = (org.apache.activemq.command.DataStructure) looseUnmarsalNestedObject(wireFormat,dataIn); 130 } 131 info.setData(value); 132 } 133 else { 134 info.setData(null); 135 } 136 137 } 138 139 140 143 public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { 144 145 DataArrayResponse info = (DataArrayResponse)o; 146 147 super.looseMarshal(wireFormat, o, dataOut); 148 looseMarshalObjectArray(wireFormat, info.getData(), dataOut); 149 150 } 151 } 152 | Popular Tags |