Sorry if this doesn't do it for you, but writing this made my day.

/**
* @author dwyer
* Who says xml-rpc can't pass java objects?
* just serialize, stream to byte[] rinse, and repeat.
*/
public class Utils {

public static byte[] byteArrayFromObj(java.io.Serializable obj){
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = null;
try{
oos = new ObjectOutputStream(bos);
oos.writeObject(obj);
}catch(IOException e){
System.out.println();
return null;
}
return bos.toByteArray();
}

public static Object objFromByteArray(byte[] ba){
ByteArrayInputStream bis = null;
ObjectInputStream ois = null;
Object rtn = null;
try{
bis = new ByteArrayInputStream(ba);
ois = new ObjectInputStream(bis);
rtn = ois.readObject();
}catch(IOException e){
System.out.println("io except");
return null;
}catch(ClassNotFoundException e){
System.out.println("c not found");
return null;
}
return rtn;
}
}


These Tiff commentaries are actually pretty fun to read. Go 'team that must not be named'!