1 /*2 * Copyright (C) The MX4J Contributors.3 * All rights reserved.4 *5 * This software is distributed under the terms of the MX4J License version 1.0.6 * See the terms of the MX4J License in the documentation provided with this software.7 */8 9 package mx4j.tools.remote.caucho.serialization;10 11 import java.io.ByteArrayInputStream ;12 import java.io.IOException ;13 import java.io.ObjectInputStream ;14 15 import com.caucho.hessian.io.AbstractHessianInput;16 import com.caucho.hessian.io.Deserializer;17 18 /**19 * @version $20 */21 class JMXDeserializer extends Deserializer22 {23 private Class type;24 25 JMXDeserializer(Class type)26 {27 this.type = type;28 }29 30 public Class getType()31 {32 return type;33 }34 35 public Object readMap(AbstractHessianInput in) throws IOException 36 {37 try38 {39 byte[] bytes = in.readBytes();40 ByteArrayInputStream bais = new ByteArrayInputStream (bytes);41 ObjectInputStream ois = new ObjectInputStream (bais);42 Object result = ois.readObject();43 ois.close();44 return result;45 }46 catch (ClassNotFoundException x)47 {48 throw new IOException (x.toString());49 }50 }51 }52