byte[] dummyStartBytes = {1, 2, 3, 4, 5, 6, 7, 8};
byte[] dummyEndBytes = {8, 7, 6, 5, 4, 3, 2, 1};
ObjectOutput oo = marshaller.startObjectOutput(out, false ,12);
try {
oo.write(dummyStartBytes);
cs.toStream(new UnclosableObjectOutputStream(oo));
oo.flush();
oo.write(dummyEndBytes);
} finally {
marshaller.finishObjectOutput(oo);
out.close();