private void WriteStringFragment( string str, int offset, int count, char[] helperBuffer ) {
int bufferSize = helperBuffer.Length;
while ( count > 0 ) {
int copyCount = count;
if ( copyCount > bufferSize ) {
copyCount = bufferSize;
}
str.CopyTo( offset, helperBuffer, 0, copyCount );
textWriter.Write( helperBuffer, 0, copyCount );
offset += copyCount;
count -= copyCount;
}
}