public static void writeVector(Vector<?> list, DataOutput out) throws IOException {

    InternalDataSerializer.checkOut(out);

    int size;
    if (list == null) {
      size = -1;
    } else {
      size = list.size();
    }
    InternalDataSerializer.writeArrayLength(size, out);
    if (logger.isTraceEnabled(LogMarker.SERIALIZER_VERBOSE)) {
      logger.trace(LogMarker.SERIALIZER_VERBOSE, "Writing Vector with {} elements: {}", size, list);
    }
    if (size > 0) {
      for (int i = 0; i < size; i++) {
        writeObject(list.get(i), out);
      }
    }
  }
Writes an <code>Vector</code> to a <code>DataOutput</code>. Note that even though
<code>list</code> may be an instance of a subclass of <code>Vector</code>,
<code>readVector</code> will always return an instance of <code>Vector</code>, <B>not</B> an
instance of the subclass. To preserve the class type of <code>list</code>,
{@link #writeObject(Object, DataOutput)} should be used for data serialization.

@param list the <code>Vector</code> to write
@param out the {@link DataInput} to write to

@throws IOException A problem occurs while writing to <code>out</code>

@see #readVector
@since GemFire 5.7
geode-core/src/main/java/org/apache/geode/DataSerializer.java