1 55 56 package org.jboss.axis.encoding.ser; 57 58 import org.jboss.axis.components.image.ImageIOFactory; 59 import org.jboss.axis.encoding.DeserializationContext; 60 import org.jboss.logging.Logger; 61 import org.xml.sax.Attributes ; 62 import org.xml.sax.SAXException ; 63 64 import javax.activation.DataHandler ; 65 import java.awt.*; 66 import java.io.InputStream ; 67 68 72 public class ImageDataHandlerDeserializer extends JAFDataHandlerDeserializer 73 { 74 private static Logger log = Logger.getLogger(ImageDataHandlerDeserializer.class.getName()); 75 76 public void startElement(String namespace, String localName, 77 String prefix, Attributes attributes, 78 DeserializationContext context) 79 throws SAXException 80 { 81 82 super.startElement(namespace, localName, prefix, attributes, context); 83 84 if (getValue() instanceof DataHandler ) 85 { 86 try 87 { 88 DataHandler dh = (DataHandler )getValue(); 89 90 InputStream is = dh.getInputStream(); 91 Image image = ImageIOFactory.getImageIO().loadImage(is); 92 setValue(image); 93 } 94 catch (Exception e) 95 { 96 } 97 } 98 } } | Popular Tags |