Java Encode encode(Object o)

Here you can find the source of encode(Object o)

Description

encode

License

Open Source License

Declaration

public static byte[] encode(Object o) throws IOException 

Method Source Code


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

import java.io.*;

public class Main {
    public static byte[] encode(Object o) throws IOException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream os = new ObjectOutputStream(bos);
        os.writeObject(o);//from   w  w  w . j  a  v a2s  .c  om
        os.close();
        bos.close();
        byte[] arr = bos.toByteArray();
        return arr;
    }
}

Related

  1. encode(Object o)
  2. encode(Object obj)
  3. encode(Serializable s)
  4. encode(T obj)
  5. encode2Encode(String original, String encode1, String encode2)