import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
public class util {
public static byte[] SerializeObject(Object o)
{
byte [] buffer = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos;
try {
oos = new ObjectOutputStream(baos);
oos.writeObject(o);
oos.close();
buffer = baos.toByteArray();
} catch (IOException e) {
e.printStackTrace();
}
return buffer;
}
}
No comments:
Post a Comment