// and return bytes.
return new ByteBuffer(baos.getRawBuffer(), 0, baos.size());
}
public Object objectFromByteBuffer(byte[] buf, int offset, int length) throws IOException, ClassNotFoundException {
ObjectInput in = new MarshalledValueInputStream(new ByteArrayInputStream(buf, offset, length));
return objectFromObjectStream(in);
}