当前位置: 首页>>代码示例>>Java>>正文


Java SystemUtils.LINE_SEPARATOR属性代码示例

本文整理汇总了Java中org.apache.commons.lang.SystemUtils.LINE_SEPARATOR属性的典型用法代码示例。如果您正苦于以下问题:Java SystemUtils.LINE_SEPARATOR属性的具体用法?Java SystemUtils.LINE_SEPARATOR怎么用?Java SystemUtils.LINE_SEPARATOR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.lang.SystemUtils的用法示例。


在下文中一共展示了SystemUtils.LINE_SEPARATOR属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStackFrameList

/**
 * <p>Produces a <code>List</code> of stack frames - the message
 * is not included. Only the trace of the specified exception is
 * returned, any caused by trace is stripped.</p>
 *
 * <p>This works in most cases - it will only fail if the exception
 * message contains a line that starts with:
 * <code>&quot;&nbsp;&nbsp;&nbsp;at&quot;.</code></p>
 * 
 * @param t is any throwable
 * @return List of stack frames
 */
static List getStackFrameList(Throwable t) {
    String stackTrace = getStackTrace(t);
    String linebreak = SystemUtils.LINE_SEPARATOR;
    StringTokenizer frames = new StringTokenizer(stackTrace, linebreak);
    List list = new ArrayList();
    boolean traceStarted = false;
    while (frames.hasMoreTokens()) {
        String token = frames.nextToken();
        // Determine if the line starts with <whitespace>at
        int at = token.indexOf("at");
        if (at != -1 && token.substring(0, at).trim().length() == 0) {
            traceStarted = true;
            list.add(token);
        } else if (traceStarted) {
            break;
        }
    }
    return list;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:ExceptionUtils.java

示例2: getStackFrameList

static List<String> getStackFrameList(Throwable t)
{
  String stackTrace = getStackTrace(t);
  String linebreak = SystemUtils.LINE_SEPARATOR;
  StringTokenizer frames = new StringTokenizer(stackTrace, linebreak);
  List<String> list = new ArrayList<String>();
  boolean traceStarted = false;
  while (frames.hasMoreTokens()) {
    String token = frames.nextToken();

    int at = token.indexOf("at");
    if ((at != -1) && (token.substring(0, at).trim().length() == 0)) {
      traceStarted = true;
      list.add(token); 
    } else {
      if (traceStarted)
        break;
    }
  }
  return list;
}
 
开发者ID:thinking-github,项目名称:nbone,代码行数:21,代码来源:ExceptionUtils.java

示例3: writeWrapped

/**
 * Writes one or more lines of text, applying line wrapping.
 */
private void writeWrapped(final String text) {

  // Handle the case of multiple lines
  if (text.contains(SystemUtils.LINE_SEPARATOR)) {
    for (String line : text.split(SystemUtils.LINE_SEPARATOR)) {
      writeWrapped(line);
    }
    return;
  }

  // Write anything below the wrapping limit
  if (text.length() < LINE_LENGTH) {
    outputStream.println(text);
    return;
  }

  // Measure the indent to use on the split lines
  int indent = 0;
  while (indent < text.length() && text.charAt(indent) == ' ') {
    indent++;
  }
  indent += 2;

  // Split the line, preserving the indent on new lines
  final String firstLineIndent = text.substring(0, indent);
  final String lineSeparator = SystemUtils.LINE_SEPARATOR + StringUtils.repeat(" ", indent);
  outputStream.println(firstLineIndent + WordUtils.wrap(text.substring(indent), LINE_LENGTH - indent, lineSeparator, false));
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:31,代码来源:ChangelogStatementConsumer.java

示例4: getStackFrames

static String[] getStackFrames(String stackTrace)
{
  String linebreak = SystemUtils.LINE_SEPARATOR;
  StringTokenizer frames = new StringTokenizer(stackTrace, linebreak);
  List<String> list = new ArrayList<String>();
  while (frames.hasMoreTokens()) {
    list.add(frames.nextToken());
  }
  return toArray(list);
}
 
开发者ID:thinking-github,项目名称:nbone,代码行数:10,代码来源:ExceptionUtils.java

示例5: toString

@Override
public String toString() {
  return JOINER.join(keywords.values()) + SystemUtils.LINE_SEPARATOR;
}
 
开发者ID:googleads,项目名称:keyword-optimizer,代码行数:4,代码来源:KeywordCollection.java

示例6: getStackFrames

/**
 * <p>Returns an array where each element is a line from the argument.</p>
 *
 * <p>The end of line is determined by the value of {@link SystemUtils#LINE_SEPARATOR}.</p>
 *
 * <p>Functionality shared between the
 * <code>getStackFrames(Throwable)</code> methods of this and the
 * {@link org.apache.commons.lang.exception.NestableDelegate} classes.</p>
 *
 * @param stackTrace  a stack trace String
 * @return an array where each element is a line from the argument
 */
static String[] getStackFrames(String stackTrace) {
    String linebreak = SystemUtils.LINE_SEPARATOR;
    StringTokenizer frames = new StringTokenizer(stackTrace, linebreak);
    List list = new ArrayList();
    while (frames.hasMoreTokens()) {
        list.add(frames.nextToken());
    }
    return toArray(list);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:ExceptionUtils.java


注:本文中的org.apache.commons.lang.SystemUtils.LINE_SEPARATOR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。