question: private static int addToBuffer ( Writer out , char [ ] buffer , int bufferIndex , int bufferLength , char ch ) throws IOException { if ( bufferIndex >= bufferLength ) { out . write ( buffer , 0 , bufferIndex ) ; bufferIndex = 0 ; } buffer [ bufferIndex ] = ch ; return bufferIndex + 1 ; }
target:  Add a character to the buffer, flushing the buffer if the buffer is full, and returning the new buffer index