Format a description of a Parameterizable (including recursive options).

@param buf Buffer to append to.
@param pcls Parameterizable class to describe
@param width Width
@param indent Text indent
@return Formatted description
322274
public static StringBuilder describeParameterizable(StringBuilder buf, Class<?> pcls, int width, String indent) throws ClassInstantiationException {
    println(buf, width, "Description for class " + pcls.getName());

    Title title = pcls.getAnnotation(Title.class);
    if(title != null && title.value() != null && !title.value().isEmpty()) {
      println(buf, width, title.value());
    }

    Description desc = pcls.getAnnotation(Description.class);
    if(desc != null && desc.value() != null && !desc.value().isEmpty()) {
      println(buf, width, desc.value());
    }

    for(Reference ref : pcls.getAnnotationsByType(Reference.class)) {
      if(!ref.prefix().isEmpty()) {
        println(buf, width, ref.prefix());
      }
      println(buf, width, ref.authors());
      println(buf, width, ref.title());
      println(buf, width, ref.booktitle());
      if(ref.url().length() > 0) {
        println(buf, width, ref.url());
      }
    }

    SerializedParameterization config = new SerializedParameterization();
    TrackParameters track = new TrackParameters(config);
    @SuppressWarnings("unused")
    Object p = ClassGenericsUtil.tryInstantiate(Object.class, pcls, track);
    Collection<TrackedParameter> options = track.getAllParameters();
    if(!options.isEmpty()) {
      OptionUtil.formatForConsole(buf, width, options);
    }
    return buf;
  }
760631
def formatLine(self, line, indent=0, outcome_char=''):
        
        actual_spaces = (indent * self.indent_spaces) - len(outcome_char)
        return (outcome_char + ' ' * actual_spaces + line)
209449
public void appendCSSDefinition(StringBuilder buf) {
    buf.append("\n.");
    buf.append(name);
    buf.append('{');
    for (Pair<String, String> pair : statements) {
      buf.append(pair.getFirst());
      buf.append(':');
      buf.append(pair.getSecond());
      buf.append(";\n");
    }
    buf.append("}\n");
  }
1238663
public void writeIndentation(final OutputStream result) throws IOException {
        result.write(LIST_LEVEL_FIRST_INDENT);
        result.write(intToByteArray(firstIndent));
        result.write(RtfParagraphStyle.INDENT_LEFT);
        result.write(intToByteArray(leftIndent));
        result.write(RtfParagraphStyle.INDENT_RIGHT);
        result.write(intToByteArray(rightIndent));
        result.write(LIST_LEVEL_SYMBOL_INDENT);
        result.write(intToByteArray(this.leftIndent));

    }
44970
public static StringBuilder appendSpace(StringBuilder buf, int spaces) {
    for(int i = spaces; i > 0; i -= SPACEPADDING.length) {
      buf.append(SPACEPADDING, 0, i < SPACEPADDING.length ? i : SPACEPADDING.length);
    }
    return buf;
  }
297402
@Override
    public IndentedPrintWriter printf(String format, Object... args) {
        super.format(format, args);
        return this;
    }
780141
def format(self, indent_level, indent_size=4):
        

        name = self.format_name('Boolean', indent_size)

        if self._require_value is not None:
            if self.long_desc is not None:
                name += '\n'

            name += self.wrap_lines('must be %s\n' % str(self._require_value).lower(), 1, indent_size)

        return self.wrap_lines(name, indent_level, indent_size)
820131
public StringBuffer format(Calendar calendar, StringBuffer buf) {
        if (mTimeZoneForced) {
            calendar.getTime(); /// LANG-538
            calendar = (Calendar) calendar.clone();
            calendar.setTimeZone(mTimeZone);
        }
        return applyRules(calendar, buf);
    }
85339
public void format(final int fieldStart, final StringBuffer buffer) {
    final int rawLength = buffer.length() - fieldStart;

    if (rawLength > maxLength) {
      if(rightTruncate) {
         buffer.setLength(fieldStart + maxLength);
      } else {
         buffer.delete(fieldStart, buffer.length() - maxLength);
      }
    } else if (rawLength < minLength) {
      if (leftAlign) {
        final int fieldEnd = buffer.length();
        buffer.setLength(fieldStart + minLength);

        for (int i = fieldEnd; i < buffer.length(); i++) {
          buffer.setCharAt(i, ' ');
        }
      } else {
        int padLength = minLength - rawLength;

        for (; padLength > 8; padLength -= 8) {
          buffer.insert(fieldStart, SPACES);
        }

        buffer.insert(fieldStart, SPACES, 0, padLength);
      }
    }
  }
833736
public void format(StringBuffer fmt, Set done, Set todo, int indent) {
    formatName(fmt, indent);
    fmt.append("{\n");
    for (int i = 0; i < cases.length; i++) {
      if (i > 0)
        fmt.append(" |\n");
      cases[i].format(fmt, done, todo, indent + 2);
    }
    fmt.append("\n");
    indent(fmt, indent);
    fmt.append("}");
  }
1088808
public static void append(final StringBuilder builder, final String indent, final String line)
    {
        builder.append(indent).append(line).append('\n');
    }
487445
public void format(StringBuffer fmt, Set done, Set todo, int indent) {
    formatName(fmt, indent);
    fmt.append("[");
    if (fields != null) {
      fmt.append("\n");
      for (int i = 0; i < fields.length; i++) {
        if (i > 0)
          fmt.append(",\n");
        fields[i].format(fmt, done, todo, indent + 2);
      }
      fmt.append("\n");
      indent(fmt, indent);
    }
    fmt.append("]");
  }
725481
private static void println(StringBuilder buf, int width, String data) {
    for(String line : FormatUtil.splitAtLastBlank(data, width)) {
      buf.append(line);
      if(!line.endsWith(FormatUtil.NEWLINE)) {
        buf.append(FormatUtil.NEWLINE);
      }
    }
  }
824175
void zeroWidthSpace(int indentLevel) throws IOException {
    if (closed) throw new IllegalStateException("closed");

    if (column == 0) return;
    if (this.nextFlush != null) flush(nextFlush);
    this.nextFlush = FlushType.EMPTY;
    this.indentLevel = indentLevel;
  }
114171
def indentsize(line):
    """"""
    expline = string.expandtabs(line)
    return len(expline) - len(string.lstrip(expline))
297609
private static String formatByte(final byte[] pByte, final boolean pSpace, final boolean pTruncate) {
		String result;
		if (pByte == null) {
			result = "";
		} else {
			int i = 0;
			if (pTruncate) {
				while (i < pByte.length && pByte[i] == 0) {
					i++;
				}
			}
			if (i < pByte.length) {
				int sizeMultiplier = pSpace ? 3 : 2;
				char[] c = new char[(pByte.length - i) * sizeMultiplier];
				byte b;
				for (int j = 0; i < pByte.length; i++, j++) {
					b = (byte) ((pByte[i] & LEFT_MASK) >> 4);
					c[j] = (char) (b > 9 ? b + CHAR_DIGIT_SEVEN : b + CHAR_DIGIT_ZERO);
					b = (byte) (pByte[i] & RIGHT_MASK);
					c[++j] = (char) (b > 9 ? b + CHAR_DIGIT_SEVEN : b + CHAR_DIGIT_ZERO);
					if (pSpace) {
						c[++j] = CHAR_SPACE;
					}
				}
				result = pSpace ? new String(c, 0, c.length - 1) : new String(c);
			} else {
				result = "";
			}
		}
		return result;
	}
24295
public void formatField(ZonedDateTime datetime, char field, int width, StringBuilder buffer) {
    switch (field) {
      case 'G':
        formatEra(buffer, datetime, width, eras);
        break;

      case 'y':
        formatYear(buffer, datetime, width);
        break;

      case 'Y':
        formatISOYearWeekOfYear(buffer, datetime, width);
        break;

      case 'u':
      case 'U':
      case 'r':
        // Only used for non-Gregorian calendars
        break;

      case 'Q':
        formatQuarter(buffer, datetime, width, quartersFormat);
        break;

      case 'q':
        formatQuarter(buffer, datetime, width, quartersStandalone);
        break;

      case 'M':
        formatMonth(buffer, datetime, width, monthsFormat);
        break;

      case 'L':
        formatMonth(buffer, datetime, width, monthsStandalone);
        break;

      case 'l':
        // deprecated, ignore
        break;

      case 'w':
        formatISOWeekOfYear(buffer, datetime, width);
        break;

      case 'W':
        formatWeekOfMonth(buffer, datetime, width);
        break;

      case 'd':
        formatDayOfMonth(buffer, datetime, width);
        break;

      case 'D':
        formatDayOfYear(buffer, datetime, width);
        break;

      case 'F':
        formatDayOfWeekInMonth(buffer, datetime, width);
        break;

      case 'g':
        // modified julian day
        break;

      case 'E':
        formatWeekday(buffer, datetime, width, weekdaysFormat);
        break;

      case 'e':
        formatLocalWeekday(buffer, datetime, width, weekdaysFormat, firstDay);
        break;

      case 'c':
        formatLocalWeekdayStandalone(buffer, datetime, width, weekdaysStandalone, firstDay);
        break;

      case 'a':
        formatDayPeriod(buffer, datetime, width, dayPeriodsFormat);
        break;

      case 'b':
        // Not yet in use.
        // TODO: day periods: am, pm, noon, midnight
        break;
        
      case 'B':
        // Not yet in use.
        // TODO: flexible day periods: "at night"
        break;

      case 'h':
        formatHours(buffer, datetime, width, true);
        break;

      case 'H':
        formatHours(buffer, datetime, width, false);
        break;

      case 'K':
        formatHoursAlt(buffer, datetime, width, true);
        break;

      case 'k':
        formatHoursAlt(buffer, datetime, width, false);
        break;
        
      case 'j':
      case 'J':
      case 'C':
        // Input skeleton symbols, not implemented.
        break;

      case 'm':
        formatMinutes(buffer, datetime, width);
        break;

      case 's':
        formatSeconds(buffer, datetime, width);
        break;

      case 'S':
        formatFractionalSeconds(buffer, datetime, width);
        break;

      case 'A':
        // not implemented
        break;

      case 'z':
        formatTimeZone_z(buffer, datetime, width);
        break;

      case 'Z':
        formatTimeZone_Z(buffer, datetime, width);
        break;
        
      case 'O':
        formatTimeZone_O(buffer, datetime, width);
        break;
        
      case 'v':
        formatTimeZone_v(buffer, datetime, width);
        break;
        
      case 'V':
        formatTimeZone_V(buffer, datetime, width);
        break;
        
      case 'X':
      case 'x':
        formatTimeZone_X(buffer, datetime, width, field);
        break;
    }
  }