dap4/d4servlet/src/main/java/dap4/servlet/ChunkWriter.java
public void close()
            throws IOException
    {
        if(closed)
            return;
        closed = true;

        if(dmr8 != null) {
            sendDXR(dmr8);
            dmr8 = null;
        }

        if(mode == RequestMode.DMR)
            return; // only DMR should be sent

        // If there is no partial chunk to write then
        // we are done; else verify we can write and write the last
        // chunk; => multiple closes are ok.
        if(chunk == null || chunk.position() == 0)
            return;

        // There is data left to write.
        verifystate(); // are we in a state supporting data write?

        // Force out the current chunk (might be empty)
        // but do not close the underlying output stream
        state = State.DATA; // pretend

        int flags = DapUtil.CHUNK_END;
        writeChunk(flags);
        state = State.END;
        this.output.flush(); // Do not close
        if(this.saveoutput != null) {
            // write to true output target
            this.saveoutput.write(((ByteArrayOutputStream) this.output).toByteArray());
        }
    }
public void close()
            throws IOException
    {
        if(closed)
            return;
        closed = true;

        if(dmr8 != null) {
            sendDXR(dmr8);
            dmr8 = null;
        }

        if(mode == RequestMode.DMR)
            return; // only DMR should be sent

        // If there is no partial chunk to write then
        // we are done; else verify we can write and write the last
        // chunk; => multiple closes are ok.
        if(chunk == null || chunk.position() == 0)
            return;

        // There is data left to write.
        verifystate(); // are we in a state supporting data write?

        // Force out the current chunk (might be empty)
        // but do not close the underlying output stream
        state = State.DATA; // pretend

        int flags = DapUtil.CHUNK_END;
        writeChunk(flags);
        state = State.END;
        this.output.flush(); // Do not close
        if(this.saveoutput != null) {
            // write to true output target
            this.saveoutput.write(((ByteArrayOutputStream) this.output).toByteArray());
        }
    }
public void close ( ) throws IOException { if ( closed ) return ; closed = true ; if ( dmr8 != null ) { sendDXR ( dmr8 ) ; dmr8 = null ; } if ( mode == RequestMode . DMR ) return ; // only DMR should be sent // If there is no partial chunk to write then // we are done; else verify we can write and write the last // chunk; => multiple closes are ok. if ( chunk == null || chunk . position ( ) == 0 ) return ; // There is data left to write. verifystate ( ) ; // are we in a state supporting data write? // Force out the current chunk (might be empty) // but do not close the underlying output stream state = State . DATA ; // pretend int flags = DapUtil . CHUNK_END ; writeChunk ( flags ) ; state = State . END ; this . output . flush ( ) ; // Do not close if ( this . saveoutput != null ) { // write to true output target this . saveoutput . write ( ( ( ByteArrayOutputStream ) this . output ) . toByteArray ( ) ) ; } }
Closes this output stream and releases any system resources
associated with this stream. Except, the underlying stream is not
actually closed; that is left to the servlet level

@throws IOException on IO related errors
Closes this output stream and releases any system resources associated with this stream . Except the underlying stream is not actually closed ; that is left to the servlet level