Examples of GaeaOutStream


Examples of com.bj58.spat.gaea.serializer.component.GaeaOutStream

    /*
     * @return  对象序列化后的字节数组
     * @param   obj     要序列化的对象
     */
    public byte[] Serialize(Object obj) throws Exception {
        GaeaOutStream stream = null;
        try {
            stream = new GaeaOutStream();
            stream.Encoder = _Encoder;
            if (obj == null) {
                SerializerFactory.GetSerializer(null).WriteObject(obj, stream);
            } else {
                Class type = obj.getClass();
                if (obj instanceof IGaeaSerializer) {
                    ((IGaeaSerializer) obj).Serialize(stream);
                } else {
                    SerializerFactory.GetSerializer(type).WriteObject(obj, stream);
                }
            }
            byte[] result = stream.toByteArray();
            return result;
        } finally {
            if (stream != null) {
                stream.close();
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.