opendap/src/main/java/opendap/dap/DVector.java
public void externalize(DataOutputStream sink) throws IOException {

        // Because arrays of primitive types (ie int32, float32, byte, etc) are
        // handled in the C++ core using the XDR package we must write the
        // length twice for those types. For BaseType vectors, we should write
        // it only once. This is in effect a work around for a bug in the C++
        // core as the C++ core does not consume 2 length values for thge
        // BaseType vectors. Bummer...
        int length = vals.getLength();
        sink.writeInt(length);

        if (!(vals instanceof BaseTypePrimitiveVector)) {
            // because both XDR and OPeNDAP write the length, we must write it twice
            sink.writeInt(length);
        }

        vals.externalize(sink);
    }
public void externalize(DataOutputStream sink) throws IOException {

        // Because arrays of primitive types (ie int32, float32, byte, etc) are
        // handled in the C++ core using the XDR package we must write the
        // length twice for those types. For BaseType vectors, we should write
        // it only once. This is in effect a work around for a bug in the C++
        // core as the C++ core does not consume 2 length values for thge
        // BaseType vectors. Bummer...
        int length = vals.getLength();
        sink.writeInt(length);

        if (!(vals instanceof BaseTypePrimitiveVector)) {
            // because both XDR and OPeNDAP write the length, we must write it twice
            sink.writeInt(length);
        }

        vals.externalize(sink);
    }
Writes data to a <code>DataOutputStream</code>. This method is used
primarily by GUI clients which need to download OPeNDAP data, manipulate
it, and then re-save it as a binary file.

@param sink a <code>DataOutputStream</code> to write to.
@throws IOException thrown on any <code>OutputStream</code>
exception.