Example usage for java.lang System lineSeparator

List of usage examples for java.lang System lineSeparator

Introduction

In this page you can find the example usage for java.lang System lineSeparator.

Prototype

String lineSeparator

To view the source code for java.lang System lineSeparator.

Click Source Link

Usage

From source file:io.hawkcd.agent.utilities.ReportAppender.java

public static StringBuilder appendInfoMessage(String message, StringBuilder report) {

    //message = MessageConstants.CONSOLE_WHITE + message;
    if (!message.isEmpty()) {
        String formattedMessage = String.format("%s %s", getTimeStamp(), message);

        System.out.println(StringEscapeUtils.unescapeJava(formattedMessage));

        report.append(formattedMessage).append(System.lineSeparator());
    } else {//from  w  ww  . j  a v  a2 s  . c om
        report.append(message).append(System.lineSeparator());
    }
    return report;
}

From source file:com.ibm.nytimes.BestSellerList.java

public String toString() {
    StringBuffer sb = new StringBuffer();

    for (Book b : books) {
        sb.append(b.toString());//  ww w . ja  v  a 2  s.c o m
        sb.append(System.lineSeparator());
    }

    return sb.toString();
}

From source file:com.blackducksoftware.integration.hub.detect.help.print.HelpTextWriter.java

public void write(final PrintStream printStream) {
    printStream.println(String.join(System.lineSeparator(), pieces));
}

From source file:ipgraph.datastructure.DTree.java

@Override
public String toString() {
    return this.stream().filter(x -> x != padding).map(x -> x.toString() + System.lineSeparator())
            .reduce((x, y) -> x + y).get();
}

From source file:com.ibm.twitter.TweetList.java

public String toString() {
    StringBuffer sb = new StringBuffer();

    for (TweetMessage tweet : tweets) {
        sb.append(tweet.toString());/*from   ww  w  . j a va  2  s .  c o m*/
        sb.append(System.lineSeparator());
    }

    return sb.toString();
}

From source file:io.cloudslang.lang.compiler.parser.MetadataParser.java

public ParsedDescriptionData parse(SlangSource source) {
    Validate.notNull(source.getContent(), "Source " + source.getName() + " cannot be null");
    try {//from   w  w w . j av a 2  s .  c  om
        return extractDescriptionData(source);
    } catch (Throwable e) {
        throw new RuntimeException("There was a problem parsing the description: " + source.getName() + "."
                + System.lineSeparator() + parserExceptionHandler.getErrorMessage(e), e);
    }
}

From source file:uk.ac.sanger.cgp.wwdocker.actions.Utils.java

public static String logOutput(String stdout, Level type) {
    String remainder = null;/*from   w w w. jav  a  2 s  .co m*/
    String[] lines = stdout.split(System.lineSeparator());
    if (!stdout.endsWith(System.lineSeparator())) {
        remainder = lines[lines.length - 1];
    }
    int limit = lines.length;
    if (remainder == null) {
        remainder = "";
    } else {
        limit--;
    }
    for (int i = 0; i < limit; i++) {
        logger.log(type, "\t" + lines[i]);
    }
    return remainder;
}

From source file:br.com.mv.modulo.utils.ModuloEmailSender.java

public void sendException(Exception exception) {
    StringBuilder str = new StringBuilder();
    str.append("Erro: " + exception.toString() + System.lineSeparator());
    str.append("Mensagem: " + exception.getLocalizedMessage() + System.lineSeparator());
    str.append("Stack: " + System.lineSeparator());
    for (StackTraceElement element : exception.getStackTrace()) {
        str.append(element.toString() + System.lineSeparator());
    }//from   w ww  . j  a  v a2s. c  o  m

    sendEmail(str.toString());
}

From source file:com.htmlhifive.pitalium.common.util.JSONUtilsTest.java

@Test
public void testToStringWithIndent() throws Exception {
    String result = JSONUtils.toStringWithIndent(data);
    assertThat(result.split(System.lineSeparator()), is(new String[] { "{", "  \"a\" : \"b\"", "}" }));
}

From source file:com.cloudbees.jenkins.support.filter.FilteredWriterTest.java

@Issue("JENKINS-21670")
@Test//from   w  w w  . j  a  va2  s  . c o m
public void shouldModifyStream() throws Exception {
    final int nrLines = FilteredConstants.DEFAULT_DECODER_CAPACITY;
    String inputContents = IntStream.range(0, nrLines).mapToObj(i -> "ManagedNode" + i)
            .collect(joining(System.lineSeparator()));
    CharSequenceReader reader = new CharSequenceReader(inputContents);
    ContentFilter filter = s -> s.replace("ManagedNode", "Anonymous_");
    StringWriter output = new StringWriter();
    FilteredWriter writer = new FilteredWriter(output, filter);

    IOUtils.copy(reader, writer);
    writer.flush();
    String outputContents = output.toString();

    assertThat(outputContents).isNotEmpty();
    String[] lines = FilteredConstants.EOL.split(outputContents);
    assertThat(lines).allMatch(line -> !line.contains("ManagedNode") && line.startsWith("Anonymous_"))
            .hasSize(nrLines);
}