public String getCharBufferAsString() {
    StringBuilder buffer = new StringBuilder(numberOfLinesInBuffer * numberOfColumnsInBuffer);
    for (int lineIndex = 0; lineIndex < numberOfLinesInBuffer; lineIndex++) {
      buffer.append(charBuffer, numberOfColumnsInBuffer * lineIndex, numberOfColumnsInBuffer);
      buffer.append("\n");
    }
    return buffer.toString();
  }
Rarely-used function to return the contents of the buffer as string
java/zylib/src/main/java/com/google/security/zynamics/zylib/gui/CodeDisplay/FormattedCharacterBuffer.java