code: public static void splitAndIndent(String str, int indent,
              int numChars, PrintWriter writer) {
          final int inputLength = str.length();
  
          for (int offset = 0; offset < inputLength; offset += numChars) {
              SpaceCharacters.indent(indent, writer);
              writer.append(str, offset, Math.min(offset + numChars,inputLength));
              writer.print('\n');
          }
  
      }
docs: Method that attempts to break a string up into lines no longer than the
  specified line length.
  
  <p>The string is assumed to a large chunk of undifferentiated text such
  as base 64 encoded binary data.
  
  @param str
  The input string to be split into lines.
  @param indent
  The number of spaces to insert at the start of each line.
  @param numChars
  The maximum length of each line (not counting the indent spaces).
  @param writer
  The character stream to print the output to.