Source code: org/activemq/transport/openwire/io/ProducerInfoMarshaller.java
1 /**
2 * Marshalling code for Open Wire Format for ProducerInfo
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 ProducerInfo
23 *
24 * @version $Revision: 1.1 $
25 */
26 public class ProducerInfoMarshaller 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 6;
35 }
36
37 /**
38 * @return a new Packet instance
39 */
40 public Packet createPacket() {
41 return new ProducerInfo();
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 ProducerInfo info = (ProducerInfo) packet;
54 info.setProducerId(dataIn.readShort());
55 info.setSessionId(dataIn.readShort());
56 info.setClientId(readString(dataIn));
57 info.setDestination(readDestination(dataIn));
58 info.setStarted(dataIn.readBoolean());
59 info.setStartTime(dataIn.readLong());
60
61 }
62
63 /**
64 * Write a Packet instance to data output stream
65 *
66 * @param packet the instance to be seralized
67 * @param dataOut the output stream
68 * @throws IOException thrown if an error occurs
69 */
70 public void writePacket(Packet packet, DataOutput dataOut) throws IOException {
71 super.writePacket(packet, dataOut);
72 ProducerInfo info = (ProducerInfo) packet;
73 dataOut.writeShort(info.getProducerId());
74 dataOut.writeShort(info.getSessionId());
75 writeString(info.getClientId(), dataOut);
76 writeDestination(info.getDestination(), dataOut);
77 dataOut.writeBoolean(info.isStarted());
78 dataOut.writeLong(info.getStartTime());
79
80 }
81 }