code: void writeTo(DataOutputStream out) throws IOException {
  
      // We do the UTF8 conversion ourselves instead of relying on DataOutput
      // to ensure we strictly follow UTF-8 standard, as well as better performance,
      // and save the code to count the UTF-8 bytes (we need that to calculate
      // the total length.
      int length = size() - 4;
  
      out.writeInt(length);
      out.writeShort(codecNameUTF8.length);
      out.write(codecNameUTF8);
      if (codecNameUTF8.length == 0) {
        out.writeLong(crc32Value);
      }
      out.write(storedData.getData(), 0, storedData.getLength());
    }
docs: Write this data segment into an OutputStream.