1 48 49 package com.caucho.hessian.io; 50 51 import java.io.IOException ; 52 import java.util.Enumeration ; 53 54 57 public class EnumerationSerializer extends AbstractSerializer { 58 private static EnumerationSerializer _serializer; 59 60 public static EnumerationSerializer create() 61 { 62 if (_serializer == null) 63 _serializer = new EnumerationSerializer(); 64 65 return _serializer; 66 } 67 68 public void writeObject(Object obj, AbstractHessianOutput out) 69 throws IOException 70 { 71 Enumeration iter = (Enumeration ) obj; 72 73 boolean hasEnd = out.writeListBegin(-1, null); 74 75 while (iter.hasMoreElements()) { 76 Object value = iter.nextElement(); 77 78 out.writeObject(value); 79 } 80 81 if (hasEnd) 82 out.writeListEnd(); 83 } 84 } 85 | Popular Tags |