1 18 package org.apache.activemq.transport.xmpp; 19 20 import org.apache.activemq.util.ByteArrayInputStream; 21 import org.apache.activemq.util.ByteArrayOutputStream; 22 import org.apache.activemq.util.ByteSequence; 23 import org.apache.activemq.wireformat.WireFormat; 24 import org.apache.commons.logging.Log; 25 import org.apache.commons.logging.LogFactory; 26 27 import java.io.DataInput ; 28 import java.io.DataInputStream ; 29 import java.io.DataOutput ; 30 import java.io.DataOutputStream ; 31 import java.io.IOException ; 32 33 38 public class XmppWireFormat implements WireFormat { 39 private static final Log log = LogFactory.getLog(XmppWireFormat.class); 40 41 private int version = 1; 42 43 public WireFormat copy() { 44 return new XmppWireFormat(); 45 } 46 47 96 97 190 191 public ByteSequence marshal(Object command) throws IOException { 192 ByteArrayOutputStream baos = new ByteArrayOutputStream(); 193 DataOutputStream dos = new DataOutputStream (baos); 194 marshal(command, dos); 195 dos.close(); 196 return baos.toByteSequence(); 197 } 198 199 public Object unmarshal(ByteSequence packet) throws IOException { 200 ByteArrayInputStream stream = new ByteArrayInputStream(packet); 201 DataInputStream dis = new DataInputStream (stream); 202 return unmarshal(dis); 203 } 204 205 public void marshal(Object object, DataOutput dataOutput) throws IOException { 206 207 } 208 209 public Object unmarshal(DataInput dataInput) throws IOException { 210 return null; 211 } 212 213 214 public int getVersion() { 215 return version; 216 } 217 218 public void setVersion(int version) { 219 this.version = version; 220 } 221 } 222 | Popular Tags |