Source code: org/activemq/transport/openwire/io/CapacityInfoMarshaller.java
1 /**
2 * Marshalling code for Open Wire Format for CapacityInfo
3 *
4 *
5 * NOTE!: This file is autogenerated - do not modify!
6 * if you need to make a change, please see the Groovy scripts in the
7 * activemq-openwire module
8 */
9
10 package org.activemq.transport.openwire.io;
11
12 import java.io.DataInput;
13 import java.io.DataOutput;
14 import java.io.IOException;
15
16 import org.activemq.message.*;
17 import org.activemq.io.*;
18 import org.activemq.io.impl.*;
19 import org.activemq.transport.openwire.OpenWirePacketMarshallerSupport;
20
21 /**
22 * AUTOGENERATED Marshaller for OpenWire command CapacityInfo
23 *
24 * @version $Revision: 1.1 $
25 */
26 public class CapacityInfoMarshaller extends OpenWirePacketMarshallerSupport {
27
28 /**
29 * Return the type of Packet
30 *
31 * @return integer representation of the type of Packet
32 */
33 public int getPacketType() {
34 return 4;
35 }
36
37 /**
38 * @return a new Packet instance
39 */
40 public Packet createPacket() {
41 return new CapacityInfo();
42 }
43
44 /**
45 * build a Packet instance from the data input stream
46 *
47 * @param packet A Packet object
48 * @param dataIn the data input stream to build the packet from
49 * @throws IOException
50 */
51 public void buildPacket(Packet packet, DataInput dataIn) throws IOException {
52 super.buildPacket(packet, dataIn);
53 CapacityInfo info = (CapacityInfo) packet;
54 info.setCapacity(dataIn.readInt());
55 info.setResourceName(readString(dataIn));
56 info.setCorrelationId(dataIn.readShort());
57 info.setFlowControlTimeout(dataIn.readLong());
58
59 }
60
61 /**
62 * Write a Packet instance to data output stream
63 *
64 * @param packet the instance to be seralized
65 * @param dataOut the output stream
66 * @throws IOException thrown if an error occurs
67 */
68 public void writePacket(Packet packet, DataOutput dataOut) throws IOException {
69 super.writePacket(packet, dataOut);
70 CapacityInfo info = (CapacityInfo) packet;
71 dataOut.writeInt(info.getCapacity());
72 writeString(info.getResourceName(), dataOut);
73 dataOut.writeShort(info.getCorrelationId());
74 dataOut.writeLong(info.getFlowControlTimeout());
75
76 }
77 }