code: private void writeNewClassDesc(ObjectStreamClass classDesc)
              throws IOException {
          output.writeUTF(classDesc.getName());
          output.writeLong(classDesc.getSerialVersionUID());
          byte flags = classDesc.getFlags();
  
          boolean externalizable = classDesc.isExternalizable();
  
          if (externalizable) {
              if (protocolVersion == PROTOCOL_VERSION_1) {
                  flags &= NOT_SC_BLOCK_DATA;
              } else {
                  // Change for 1.2. Objects can be saved in old format
                  // (PROTOCOL_VERSION_1) or in the 1.2 format (PROTOCOL_VERSION_2).
                  flags |= SC_BLOCK_DATA;
              }
          }
          output.writeByte(flags);
          if ((SC_ENUM | SC_SERIALIZABLE) != classDesc.getFlags()) {
              writeFieldDescriptors(classDesc, externalizable);
          } else {
              // enum write no fields
              output.writeShort(0);
          }
      }
docs: Write class descriptor {@code classDesc} into the receiver. It is
  assumed the class descriptor has not been dumped yet. The class
  descriptors for the superclass chain will be dumped as well. Returns
  the handle for this object (class descriptor) which is dumped here.
  
  @param classDesc
  The {@code ObjectStreamClass} object to dump
  
  @throws IOException
  If an IO exception happened when writing the class
  descriptor.