Here you can find the source of serializeObject(Serializable serializable)
public static byte[] serializeObject(Serializable serializable)
//package com.java2s; /**/*from ww w.j ava 2 s . c o m*/ * License: https://github.com/votingsystem/votingsystem/wiki/Licencia */ import java.io.*; import java.util.Base64; public class Main { public static byte[] serializeObject(Serializable serializable) { byte[] base64EncodedSerializedObject = null; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(serializable); oos.close(); base64EncodedSerializedObject = Base64.getEncoder().encode(baos.toByteArray()); } catch (Exception ex) { ex.printStackTrace(); } return base64EncodedSerializedObject; } }