docs: public static int writeDeferredSerialization(ByteBuffer mbuf, DeferredSerialization ds) throws IOException
      {
          int written = 0;
          try {
              final int objStartPosition = mbuf.position();
              ds.serialize(mbuf);
              written = mbuf.position() - objStartPosition;
          } finally {
              ds.cancel();
          }
          return written;
      }