Here you can find the source of serializeObject(Serializable cds)
protected static byte[] serializeObject(Serializable cds)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { protected static byte[] serializeObject(Serializable cds) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] data = null; try {/*from ww w .j a v a 2 s. c o m*/ ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(cds); data = baos.toByteArray(); oos.close(); } catch (Exception e) { e.printStackTrace(); } return data; } }