Javaでシリアライズするときにファイルベースのものが多かったので・・・
private byte[] serialize(Object object) { byte[] byteArray = null; if (object != null) { ObjectOutputStream outputStream = null; ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); try { outputStream = new ObjectOutputStream(byteStream); outputStream.writeObject(object); byteArray = byteStream.toByteArray(); } catch (Exception e) { } finally { try { if (outputStream != null) { outputStream.close(); } if (byteStream != null) { byteStream.close(); } } catch (IOException e) { } } } return byteArray; }