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