org.geotools.resources.Utilities.spaces()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中org.geotools.resources.Utilities.spaces()方法的一些代码示例,展示了Utilities.spaces()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utilities.spaces()方法的具体详情如下:
包路径:org.geotools.resources.Utilities
类名称:Utilities
方法名:spaces

Utilities.spaces介绍

[英]Returns a string of the specified length filled with white spaces. This method tries to return a pre-allocated string if possible.
[中]返回指定长度的字符串,字符串中填充空格。如果可能,此方法尝试返回预先分配的字符串。

代码示例

代码示例来源:origin: org.geotools/gt2-metadata

/**
 * Creates a new table writer with the specified
 * amount of spaces as column separator.
 *
 * @param out Writer object to provide the underlying stream,
 *        or {@code null} if there is no underlying stream.
 *        If {@code out} is null, then the {@link #toString}
 *        method is the only way to get the table's content.
 * @param spaces Amount of white spaces to use as column separator.
 */
public TableWriter(final Writer out, final int spaces) {
  this(out, Utilities.spaces(spaces));
}

代码示例来源:origin: org.geotools/gt2-metadata

/**
 * Sets the indentation to the specified value.
 */
public void setIndentation(final int width) {
  synchronized (lock) {
    margin = Utilities.spaces(width);
  }
}

代码示例来源:origin: org.geotools/gt2-metadata

/**
 * Writes spaces for a tab character.
 *
 * @throws IOException If an I/O error occurs
 */
private void expand() throws IOException {
  final int width = tabWidth - (column % tabWidth);
  out.write(Utilities.spaces(width));
  column += width;
}

代码示例来源:origin: org.geotools/gt2-metadata

/**
   * Invoked when a new line is begining. The default implementation writes the
   * current line number.
   *
   * @throws IOException If an I/O error occurs
   */
  protected void beginNewLine() throws IOException {
    final String number = String.valueOf(current++);
    out.write('[');
    out.write(Utilities.spaces(width - number.length()));
    out.write(number);
    out.write("] ");
  }
}

代码示例来源:origin: org.geotools/gt2-metadata

/**
 * Lists resources to the specified stream. If a resource has more than one line, only
 * the first line will be written. This method is used mostly for debugging purposes.
 *
 * @param  out    The destination stream.
 * @param  values The resources to list.
 * @throws IOException if an output operation failed.
 */
private static void list(final Writer out, final String[] values) throws IOException {
  final String lineSeparator = System.getProperty("line.separator", "\n");
  for (int i=0; i<values.length; i++) {
    String value = values[i];
    if (value == null) {
      continue;
    }
    int indexCR=value.indexOf('\r'); if (indexCR<0) indexCR=value.length();
    int indexLF=value.indexOf('\n'); if (indexLF<0) indexLF=value.length();
    final String number = String.valueOf(i);
    out.write(Utilities.spaces(5-number.length()));
    out.write(number);
    out.write(":\t");
    out.write(value.substring(0, Math.min(indexCR,indexLF)));
    out.write(lineSeparator);
  }
}

代码示例来源:origin: org.geotools/gt2-metadata

buffer.append(Utilities.spaces(Math.max(1, 7-status.length())))
   .append('(').append(Utilities.getShortName(category));
if (key != null) {

代码示例来源:origin: org.geotools/gt2-metadata

table.write('\n');
if (recursive != null) {
  final String nextIndent = Utilities.spaces(indent.length() + 2);
  format(table, recursive.getImplementationHints(), nextIndent, done);

代码示例来源:origin: org.geotools/gt2-widgets-swing

if (margin.length() != 0) {
    wm -= (margin.length()+3);
    buffer.append(Utilities.spaces(wm));
    buffer.append('(');
    buffer.append(margin);
buffer.append(Utilities.spaces(wm));
buffer.append(warning);
if (buffer.charAt(buffer.length()-1) != '\n') {

代码示例来源:origin: org.geotools/gt2-coverageio

out.write(isKnow ? "  " : "? ");
out.write(String.valueOf(key));
out.write(Utilities.spaces(maxLength - key.toString().length()));
out.write(separator);
out.write(String.valueOf(value));

代码示例来源:origin: org.geotools/gt2-metadata

buffer.append(Utilities.spaces(indent)).append(node).append(lineSeparator);
buffer.append(Utilities.spaces(indent)).append(node).append(':');
if (count == 1) {
  final TreeNode child = node.getChildAt(0);

代码示例来源:origin: org.geotools/gt2-metadata

buffer.append(record.getLevel().getLocalizedName());
  offset = buffer.length() - offset;
  buffer.append(Utilities.spaces(margin-offset));
assert margin >= this.margin;
if (bodyLineSeparator.length() != lineSeparator.length()+margin) {
  bodyLineSeparator = lineSeparator + Utilities.spaces(margin);

代码示例来源:origin: org.geotools/gt2-metadata

buffer.append(record.getLevel().getLocalizedName());
  offset = buffer.length() - offset;
  buffer.append(Utilities.spaces(margin-offset));
assert margin >= this.margin;
if (bodyLineSeparator.length() != lineSeparator.length()+margin) {
  bodyLineSeparator = lineSeparator + Utilities.spaces(margin);

代码示例来源:origin: org.geotools/gt2-widgets-swing

prefix=buffer.toString();
buffer.setLength(0);
second=Utilities.spaces(prefix.length());

代码示例来源:origin: org.geotools/gt2-coverageio

String n = format.format(iterator.getSampleDouble(), buffer, pos).toString();
  final int fractionOffset = Math.max(0, fractionWidth - (pos.getEndIndex() - pos.getBeginIndex()));
  out.write(Utilities.spaces(width - n.length() - fractionOffset));
  out.write(n);
  out.write(Utilities.spaces(fractionOffset));
} while (!iterator.nextPixelDone());
out.write(lineSeparator);

相关文章

微信公众号

最新文章

更多