本文整理汇总了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>" at".</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;
}
示例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;
}
示例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));
}
示例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);
}
示例5: toString
@Override
public String toString() {
return JOINER.join(keywords.values()) + SystemUtils.LINE_SEPARATOR;
}
示例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);
}