How to serialize a dataset?

Java’s native serialization works just fine with regular datasets – that’s how datasets get from gateway to clients. Wrap a ByteArrayOutputStream with an ObjectOutputStream, put the object into it, then grab the raw bytes from the BAOS.