PiRSquared17 / tomproject

Automatically exported from code.google.com/p/tomproject
0 stars 0 forks source link

create toByteArray(Object) #79

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

    public static byte[] getBytes(Object obj) throws java.io.IOException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(obj);
    oos.flush();
    oos.close();
    bos.close();
    byte[] data = bos.toByteArray();
    return data;
    }

but does the object need to be serializable? if yes, its not a secure 
approach.

Original issue reported on code.google.com by brito....@gmail.com on 31 Mar 2010 at 8:18

GoogleCodeExporter commented 9 years ago
the object needs to be serializable, so its not a secure approach

Original comment by brito....@gmail.com on 1 Apr 2010 at 8:07

GoogleCodeExporter commented 9 years ago

Original comment by brito....@gmail.com on 9 Apr 2010 at 12:39