public static void writeData(
     @NotNull WireOut wireOut,
     boolean metaData,
     boolean notReady,
     @NotNull WriteMarshallable writer) {
   Bytes bytes = wireOut.bytes();
   long position = bytes.writePosition();
   int metaDataBit = metaData ? Wires.META_DATA : 0;
   bytes.writeOrderedInt(metaDataBit | Wires.NOT_READY | Wires.UNKNOWN_LENGTH);
   writer.writeMarshallable(wireOut);
   int length =
       metaDataBit
           | toIntU30(
               bytes.writePosition() - position - 4,
               "Document length %,d out of 30-bit int range.");
   bytes.writeOrderedInt(position, length | (notReady ? Wires.NOT_READY : 0));
 }