dap4/d4servlet/src/main/java/dap4/servlet/ChunkWriter.java
void writeChunk(int flags)
            throws IOException
    {
        // If flags indicate CHUNK_END
        // and amount to write is zero,
        // go ahead and write the zero size chunk.
        if(chunk == null)
            chunk = ByteBuffer.allocate(maxbuffersize);

        int buffersize = chunk.position();
        chunkheader(buffersize, flags, header);
        // output the header followed by the data (if any)
        // Zero size chunk is ok.
        output.write(DapUtil.extract(header));
        if(buffersize > 0)
            output.write(chunk.array(), 0, buffersize);
        chunk.clear();// reset
    }
void writeChunk(int flags)
            throws IOException
    {
        // If flags indicate CHUNK_END
        // and amount to write is zero,
        // go ahead and write the zero size chunk.
        if(chunk == null)
            chunk = ByteBuffer.allocate(maxbuffersize);

        int buffersize = chunk.position();
        chunkheader(buffersize, flags, header);
        // output the header followed by the data (if any)
        // Zero size chunk is ok.
        output.write(DapUtil.extract(header));
        if(buffersize > 0)
            output.write(chunk.array(), 0, buffersize);
        chunk.clear();// reset
    }
Write out the current chunk (with given set of flags).

@param flags The flags for the header
@throws IOException on IO related errors