code: private void appendBranched(int startOffset, int pastEnd) {
          // Main tricky thing here is just replacing of linefeeds...
          if (mConvertLFs) {
              char[] inBuf = mBuffer;
              /* this will also unshare() and ensure there's room for at
               * least one more char
               */
              char[] outBuf = mBranchBuffer.getCurrentSegment();
              int outPtr = mBranchBuffer.getCurrentSegmentSize();
  
              // Pending \n to skip?
              if (mGotCR) {
                  if (inBuf[startOffset] == '\n') {
                      ++startOffset;
                  }
              }
  
              while (startOffset < pastEnd) {
                  char c = inBuf[startOffset++];
                  if (c == '\r') {
                      if (startOffset < pastEnd) {
                          if (inBuf[startOffset] == '\n') {
                              ++startOffset;
                          }
                      } else {
                          mGotCR = true;
                      }
                      c = '\n';
                  }
  
                  // Ok, let's add char to output:
                  outBuf[outPtr++] = c;
                      
                  // Need more room?
                  if (outPtr >= outBuf.length) {
                      outBuf = mBranchBuffer.finishCurrentSegment();
                      outPtr = 0;
                  }
              }
  
              mBranchBuffer.setCurrentLength(outPtr);
          } else {
              mBranchBuffer.append(mBuffer, startOffset, pastEnd-startOffset);
          }
      }
docs: /*
  ////////////////////////////////////////////////
  Internal methods
  ////////////////////////////////////////////////