code: public static void writeObject(final ObjectOutput out, final Object o)
              throws IOException {
          if (o == null) {
              out.writeByte(0);
              return;
          }
          out.writeByte(1);
          out.writeObject(o);
      }
docs: Writes the potentially null object to output. If {@code o} is null, one
  byte is written to the output to indicate that. Otherwise, the written
  size is the serialized object size plus an additional byte to indicate
  non-null.
  <p>
  This method doesn't differ in functionality with
  {@link ObjectOutput#writeObject(Object)}, including its support for
  nulls. It exists as an analogue to the other methods here and as a point
  for documenting how nulls are handled.
  </p>
  
  @param out Non-null {@link ObjectOutput}
  @param o Object being written
  @throws IOException Thrown if an I/O error occurs