private void outputFullLines() throws IOException {
    for (; ; ) {
      int leftLen = leftBuf.indexOf("\n");
      if (leftLen < 0) {
        return;
      }

      int rightLen = rightBuf.indexOf("\n");
      if (rightLen < 0) {
        return;
      }

      if (leftLen != 0) {
        out.write(leftBuf.substring(0, leftLen));
      }

      if (rightLen != 0) {
        writeSpaces(out, leftWidth - leftLen);
        out.write(rightBuf.substring(0, rightLen));
      }

      out.write('\n');

      leftBuf.delete(0, leftLen + 1);
      rightBuf.delete(0, rightLen + 1);
    }
  }
Outputs to the final destination as many full line pairs as there are in the pending output,
removing those lines from their respective buffers. This method terminates when at least one of
the two column buffers is empty.
android/android_framework/dex-maker/src/main/java/com/android/dx/util/TwoColumnOutput.java