1 48 49 package com.caucho.hessian.io; 50 51 import java.io.IOException ; 52 53 56 public class StringValueSerializer extends AbstractSerializer { 57 public void writeObject(Object obj, AbstractHessianOutput out) 58 throws IOException 59 { 60 if (obj == null) 61 out.writeNull(); 62 else { 63 if (out.addRef(obj)) 64 return; 65 66 Class cl = obj.getClass(); 67 68 int ref = out.writeObjectBegin(cl.getName()); 69 70 if (ref < 0) { 71 out.writeString("value"); 72 out.writeString(obj.toString()); 73 out.writeMapEnd(); 74 } 75 else { 76 if (ref == 0) { 77 out.writeInt(1); 78 out.writeString("value"); 79 } 80 81 out.writeString(obj.toString()); 82 } 83 } 84 } 85 } 86 | Popular Tags |