/*
* @return 对象序列化后的字节数组
* @param obj 要序列化的对象
*/
public Object Derialize(byte[] buffer, Class type) throws Exception {
GaeaInStream stream = null;
try {
stream = new GaeaInStream(buffer);
stream.Encoder = _Encoder;
if (ClassHelper.InterfaceOf(type, IGaeaSerializer.class)) {
IGaeaSerializer obj = (IGaeaSerializer) type.newInstance();
obj.Derialize(stream);
return obj;
}
return SerializerFactory.GetSerializer(type).ReadObject(stream, type);
} finally {
if (stream != null) {
stream.close();
}
}
}