Java Object Serialize serialize(Object object)

Here you can find the source of serialize(Object object)

Description

serialize

License

Apache License

Declaration

public static byte[] serialize(Object object) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.ByteArrayOutputStream;

import java.io.ObjectOutputStream;

public class Main {

    public static byte[] serialize(Object object) {
        ObjectOutputStream oos = null;
        ByteArrayOutputStream baos = null;
        try {/*  ww w  .j  av a 2 s.c o m*/
            baos = new ByteArrayOutputStream();
            oos = new ObjectOutputStream(baos);
            oos.writeObject(object);
            byte[] bytes = baos.toByteArray();
            return bytes;
        } catch (Exception e) {

        }
        return null;
    }
}

Related

  1. serialize(Object obj, String fileName)
  2. serialize(Object obj, String fname, boolean gzipped)
  3. serialize(Object objData, Class typeOfT)
  4. Serialize(Object object)
  5. serialize(Object object)
  6. serialize(Object object)
  7. serialize(Object object)
  8. serialize(Object object)
  9. serialize(Object object)