opendap/src/main/java/opendap/dap/BytePrimitiveVector.java
public void externalize(DataOutputStream sink, int start, int stop, int stride) throws IOException {
        int count = 0;
        for (int i = start; i <= stop; i += stride) {
            sink.writeByte(vals[i]);
            count++;
        }

        // pad out to a multiple of four bytes
        int modFour = count % 4;
        int pad = (modFour != 0) ? (4 - modFour) : 0;
        for (int i = 0; i < pad; i++)
            sink.writeByte(0);
    }
public void externalize(DataOutputStream sink, int start, int stop, int stride) throws IOException {
        int count = 0;
        for (int i = start; i <= stop; i += stride) {
            sink.writeByte(vals[i]);
            count++;
        }

        // pad out to a multiple of four bytes
        int modFour = count % 4;
        int pad = (modFour != 0) ? (4 - modFour) : 0;
        for (int i = 0; i < pad; i++)
            sink.writeByte(0);
    }
Write a subset of the data to a <code>DataOutputStream</code>.

@param sink    a <code>DataOutputStream</code> to write to.
@param start  starting index (i=start)
@param stop   ending index (i<=stop)
@param stride index stride (i+=stride)
@throws IOException thrown on any <code>OutputStream</code> exception.