Java Object Serialize serialize(Object obj)

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

Description

serialize

License

Open Source License

Declaration

public static byte[] serialize(Object obj) throws IOException 

Method Source Code


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

import java.io.*;

public class Main {
    public static byte[] serialize(Object obj) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try (ObjectOutputStream out = new ObjectOutputStream(baos)) {
            out.writeObject(obj);/*from  www  . ja  v  a2 s  .c o m*/
            return baos.toByteArray();
        } finally {
            baos.close();
        }
    }
}

Related

  1. serialize(Object obj)
  2. serialize(Object obj)
  3. serialize(Object obj)
  4. serialize(Object obj)
  5. serialize(Object obj)
  6. serialize(Object obj)
  7. serialize(Object obj)
  8. serialize(Object obj)
  9. serialize(Object obj)