本文整理匯總了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);
}