1 7 package org.jboss.remoting.marshal.serializable; 8 9 import java.io.IOException ; 10 import java.io.ObjectOutputStream ; 11 import java.io.OutputStream ; 12 import org.jboss.remoting.marshal.Marshaller; 13 14 20 public class SerializableMarshaller implements Marshaller 21 { 22 static final long serialVersionUID = -5553685435323600244L; 23 24 public final static String DATATYPE = "serializable"; 25 26 34 public void write(Object dataObject, OutputStream output) throws IOException 35 { 36 ObjectOutputStream oos = null; 37 if(output instanceof ObjectOutputStream ) 38 { 39 oos = (ObjectOutputStream ) output; 40 } 41 else 42 { 43 oos = new ObjectOutputStream (output); 44 } 45 oos.writeObject(dataObject); 46 47 oos.reset(); 48 oos.writeObject(Boolean.TRUE); 52 oos.flush(); 53 oos.reset(); 54 55 } 56 57 public Marshaller cloneMarshaller() 58 throws CloneNotSupportedException 59 { 60 return new SerializableMarshaller(); 61 } 62 } | Popular Tags |