opendap/src/main/java/opendap/servers/SDSequence.java
public void serialize(String dataset, DataOutputStream sink, CEEvaluator ce, Object specialO)
            throws NoSuchVariableException, DAP2ServerSideException, IOException {


        boolean moreToRead = true;

        while (moreToRead) {

            if (!isRead()) {
// ************* Pulled out the getLevel() check in order to support the "new"
// and "improved" serialization of OPeNDAP sequences. 8/31/01 ndp
//                if(getLevel() != 0 )  // Read only the outermost level
//                    return;
                moreToRead = read(dataset, specialO);
            }

            //System.out.println("Evaluating Clauses...");
            if (ce.evalClauses(specialO)) {
                //System.out.println("Clauses evaluated true");

// ************* Pulled out the getLevel() check in order to support the "new"
// and "improved" serialization of OPeNDAP sequences. 8/31/01 ndp
//                if(getLevel() == 0){
                writeMarker(sink, START_OF_INSTANCE);
//                }

                for (Enumeration e = varTemplate.elements(); e.hasMoreElements();) {
                    ServerMethods sm = (ServerMethods) e.nextElement();
                    if (sm.isProject()) {
                        if (_Debug) System.out.println("Sending variable: " + ((BaseType) sm).getEncodedName());
                        sm.serialize(dataset, sink, ce, specialO);
                    }
                }
            }
            if (moreToRead)
                setAllReadFlags(false);
        }

// ************* Pulled out the getLevel() check in order to support the "new"
// and "improved" serialization of OPeNDAP sequences. 8/31/01 ndp
//        if(getLevel() == 0){
        writeMarker(sink, END_OF_SEQUENCE);
//        }

        return;
    }
public void serialize(String dataset, DataOutputStream sink, CEEvaluator ce, Object specialO)
            throws NoSuchVariableException, DAP2ServerSideException, IOException {


        boolean moreToRead = true;

        while (moreToRead) {

            if (!isRead()) {
// ************* Pulled out the getLevel() check in order to support the "new"
// and "improved" serialization of OPeNDAP sequences. 8/31/01 ndp
//                if(getLevel() != 0 )  // Read only the outermost level
//                    return;
                moreToRead = read(dataset, specialO);
            }

            //System.out.println("Evaluating Clauses...");
            if (ce.evalClauses(specialO)) {
                //System.out.println("Clauses evaluated true");

// ************* Pulled out the getLevel() check in order to support the "new"
// and "improved" serialization of OPeNDAP sequences. 8/31/01 ndp
//                if(getLevel() == 0){
                writeMarker(sink, START_OF_INSTANCE);
//                }

                for (Enumeration e = varTemplate.elements(); e.hasMoreElements();) {
                    ServerMethods sm = (ServerMethods) e.nextElement();
                    if (sm.isProject()) {
                        if (_Debug) System.out.println("Sending variable: " + ((BaseType) sm).getEncodedName());
                        sm.serialize(dataset, sink, ce, specialO);
                    }
                }
            }
            if (moreToRead)
                setAllReadFlags(false);
        }

// ************* Pulled out the getLevel() check in order to support the "new"
// and "improved" serialization of OPeNDAP sequences. 8/31/01 ndp
//        if(getLevel() == 0){
        writeMarker(sink, END_OF_SEQUENCE);
//        }

        return;
    }
Server-side serialization for OPeNDAP variables (sub-classes of
<code>BaseType</code>). This does not send the entire class as the
Java <code>Serializable</code> interface does, rather it sends only
the binary data values. Other software is responsible for sending
variable type information (see <code>DDS</code>).<p>
<p/>
Writes data to a <code>DataOutputStream</code>. This method is used
on the server side of the OPeNDAP client/server connection, and possibly
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.
@see BaseType
@see DDS
@see ServerDDS