bundles/org.apache.jasper.glassfish/src/org/apache/jasper/runtime/JspWriterImpl.java
public void write(char cbuf[], int off, int len) 
        throws IOException 
    {
        ensureOpen();

        if (bufferSize == 0) {
            initOut();
            out.write(cbuf, off, len);
            return;
        }

        if ((off < 0) || (off > cbuf.length) || (len < 0) ||
            ((off + len) > cbuf.length) || ((off + len) < 0)) {
            throw new IndexOutOfBoundsException();
        } else if (len == 0) {
            return;
        } 

        if (len >= bufferSize) {
            /* If the request length exceeds the size of the output buffer,
               flush the buffer and then write the data directly.  In this
               way buffered streams will cascade harmlessly. */
            if (autoFlush)
                flushBuffer();
            else
                bufferOverflow();
            initOut();
            out.write(cbuf, off, len);
            return;
        }

        int b = off, t = off + len;
        while (b < t) {
            int d = min(getRemaining(), t - b);
            System.arraycopy(cbuf, b, buf.buf, buf.pos, d);
            b += d;
            buf.pos += d;
            if (getRemaining() == 0) 
                if (autoFlush)
                    flushBuffer();
                else
                    bufferOverflow();
        }

    }
public void write(char cbuf[], int off, int len) 
        throws IOException 
    {
        ensureOpen();

        if (bufferSize == 0) {
            initOut();
            out.write(cbuf, off, len);
            return;
        }

        if ((off < 0) || (off > cbuf.length) || (len < 0) ||
            ((off + len) > cbuf.length) || ((off + len) < 0)) {
            throw new IndexOutOfBoundsException();
        } else if (len == 0) {
            return;
        } 

        if (len >= bufferSize) {
            /* If the request length exceeds the size of the output buffer,
               flush the buffer and then write the data directly.  In this
               way buffered streams will cascade harmlessly. */
            if (autoFlush)
                flushBuffer();
            else
                bufferOverflow();
            initOut();
            out.write(cbuf, off, len);
            return;
        }

        int b = off, t = off + len;
        while (b < t) {
            int d = min(getRemaining(), t - b);
            System.arraycopy(cbuf, b, buf.buf, buf.pos, d);
            b += d;
            buf.pos += d;
            if (getRemaining() == 0) 
                if (autoFlush)
                    flushBuffer();
                else
                    bufferOverflow();
        }

    }
public void write ( char cbuf [ ] , int off , int len ) throws IOException { ensureOpen ( ) ; if ( bufferSize == 0 ) { initOut ( ) ; out . write ( cbuf , off , len ) ; return ; } if ( ( off < 0 ) || ( off > cbuf . length ) || ( len < 0 ) || ( ( off + len ) > cbuf . length ) || ( ( off + len ) < 0 ) ) { throw new IndexOutOfBoundsException ( ) ; } else if ( len == 0 ) { return ; } if ( len >= bufferSize ) { /* If the request length exceeds the size of the output buffer,
               flush the buffer and then write the data directly.  In this
               way buffered streams will cascade harmlessly. */ if ( autoFlush ) flushBuffer ( ) ; else bufferOverflow ( ) ; initOut ( ) ; out . write ( cbuf , off , len ) ; return ; } int b = off , t = off + len ; while ( b < t ) { int d = min ( getRemaining ( ) , t - b ) ; System . arraycopy ( cbuf , b , buf . buf , buf . pos , d ) ; b += d ; buf . pos += d ; if ( getRemaining ( ) == 0 ) if ( autoFlush ) flushBuffer ( ) ; else bufferOverflow ( ) ; } }
Write a portion of an array of characters.

<p> Ordinarily this method stores characters from the given array into
this stream's buffer, flushing the buffer to the underlying stream as
needed.  If the requested length is at least as large as the buffer,
however, then this method will flush the buffer and write the characters
directly to the underlying stream.  Thus redundant
<code>DiscardableBufferedWriter</code>s will not copy data unnecessarily.

@param  cbuf  A character array
@param  off   Offset from which to start reading characters
@param  len   Number of characters to write
Write a portion of an array of characters .