@Override
  @SuppressFBWarnings ("IL_INFINITE_LOOP")
  public void write (final char [] cbuf, final int nOfs, final int nLen) throws IOException
  {
    _ensureOpen ();
    ValueEnforcer.isArrayOfsLen (cbuf, nOfs, nLen);

    if (nLen == 0)
      return;

    if (nLen >= m_nChars)
    {
      /*
       * 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.
       */
      flushBuffer ();
      m_aWriter.write (cbuf, nOfs, nLen);
    }
    else
    {
      int b = nOfs;
      final int t = nOfs + nLen;
      while (b < t)
      {
        final int d = Math.min (m_nChars - m_nNextChar, t - b);
        System.arraycopy (cbuf, b, m_aBuf, m_nNextChar, d);
        b += d;
        m_nNextChar += d;
        if (m_nNextChar >= m_nChars)
          flushBuffer ();
      }
    }
  }
@ Override @ SuppressFBWarnings ( "IL_INFINITE_LOOP" ) public void write ( final char [ ] cbuf , final int nOfs , final int nLen ) throws IOException { _ensureOpen ( ) ; ValueEnforcer . isArrayOfsLen ( cbuf , nOfs , nLen ) ; if ( nLen == 0 ) return ; if ( nLen >= m_nChars ) { flushBuffer ( ) ; m_aWriter . write ( cbuf , nOfs , nLen ) ; } else { int b = nOfs ; final int t = nOfs + nLen ; while ( b < t ) { final int d = Math . min ( m_nChars - m_nNextChar , t - b ) ; System . arraycopy ( cbuf , b , m_aBuf , m_nNextChar , d ) ; b += d ; m_nNextChar += d ; if ( m_nNextChar >= m_nChars ) flushBuffer ( ) ; } } }
Writes 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>BufferedWriter</code>s will not
copy data unnecessarily.

@param cbuf
A character array
@param nOfs
Offset from which to start reading characters
@param nLen
Number of characters to write
@exception IOException
If an I/O error occurs