Here you can find the source of serialized(final Object item)
public static byte[] serialized(final Object item) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static byte[] serialized(final Object item) throws IOException { if (item == null) throw new NullPointerException(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try {/*from www . ja va2 s . c o m*/ oos = new ObjectOutputStream(baos); oos.writeObject(item); oos.flush(); } catch (IOException e) { throw e; } finally { try { if (oos != null) oos.close(); } catch (IOException e) { // eat it. } } return baos.toByteArray(); } }