code: public synchronized void writeDatagram (Message datagram)
          throws IOException
      {
          // first write the sequence and acknowledge numbers
          _uout.writeInt(++_lastNumber);
          _uout.writeInt(_lastReceived);
  
          // make sure the mapped sets are clear
          Set<Class<?>> mappedClasses = _uout.getMappedClasses();
          mappedClasses.clear();
          Set<String> mappedInterns = _uout.getMappedInterns();
          mappedInterns.clear();
  
          // write the object
          _uout.writeObject(datagram);
  
          // if we wrote any class mappings, we will keep them in the send record
          if (mappedClasses.isEmpty()) {
              mappedClasses = null;
          } else {
              _uout.setMappedClasses(new HashSet<Class<?>>());
  
          }
  
          // likewise with the intern mappings
          if (mappedInterns.isEmpty()) {
              mappedInterns = null;
          } else {
              _uout.setMappedInterns(new HashSet<String>());
  
          }
  
          // record the transmission
          _sendrecs.add(new SendRecord(_lastNumber, mappedClasses, mappedInterns));
      }
docs: Writes a datagram to the underlying stream.