Java Object Serialize serializeObject(Object object)

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

Description

serialize Object

License

Open Source License

Declaration

static public byte[] serializeObject(Object object) throws Exception 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.ByteArrayOutputStream;

import java.io.ObjectOutputStream;

public class Main {
    static public byte[] serializeObject(Object object) throws Exception {
        ByteArrayOutputStream os = new ByteArrayOutputStream();

        try {/*from  w  w w .j ava2 s.com*/
            ObjectOutputStream oos = new ObjectOutputStream(os);

            try {
                oos.writeObject(object);
            } finally {
                oos.close();
            }
        } finally {
            os.close();
        }

        return os.toByteArray();
    }
}

Related

  1. serializeObject(Object myObject)
  2. serializeObject(Object o)
  3. serializeObject(Object obj)
  4. serializeObject(Object obj, String destPath)
  5. serializeObject(Object obj, String dir)
  6. serializeObject(Object object)
  7. serializeObject(Object object, File f)
  8. serializeObject(Object serializedObject)