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:it.sonarlint.cli.tools.SonarlintCli.java

public String[] getErrLines() {
    return getErr().split(System.lineSeparator());
}

From source file:org.apache.camel.maven.DocumentationEnricher.java

private String formatTextContent(Element item, String textContent) {
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append(System.lineSeparator()).append(WordUtils.wrap(textContent, Constants.WRAP_LENGTH))
            .append(System.lineSeparator())
            // Fix closing tag intention.
            .append(StringUtils.repeat(Constants.DEFAULT_XML_INTENTION, getNodeDepth(item)));
    return stringBuilder.toString();
}

From source file:org.smigo.user.MailHandler.java

public void sendReviewRequest(String title, List<?> current, Object edit, AuthenticatedUser user) {
    User u = user == null ? null : userHandler.getUserById(user.getId());
    String indentation = "  ";
    StringBuilder sb = new StringBuilder(title);
    sb.append(System.lineSeparator());
    sb.append("----------------------------------------------");
    sb.append(System.lineSeparator()).append(System.lineSeparator());
    sb.append("Current value(s):").append(System.lineSeparator());
    sb.append(indentation).append(current.stream().map(Object::toString)
            .collect(Collectors.joining(System.lineSeparator() + indentation)));
    sb.append(System.lineSeparator()).append(System.lineSeparator());
    sb.append("Changing value:").append(System.lineSeparator());
    sb.append(indentation).append(edit);
    sb.append(System.lineSeparator()).append(System.lineSeparator());
    sb.append("Requested by user:").append(System.lineSeparator());
    sb.append(indentation).append(u);/*from w  w  w .j a v a 2  s. c  o  m*/
    sendAdminNotification("review request", sb.toString());
}

From source file:org.apache.zeppelin.jupyter.JupyterUtil.java

public Note getNote(Nbformat nbformat, String codeReplaced, String markdownReplaced) {
    Note note = new Note();

    String name = nbformat.getMetadata().getTitle();
    if (null == name) {
        name = "Note converted from Jupyter";
    }//from  w  w  w . ja  va 2 s .c  o  m
    note.setName(name);

    String lineSeparator = System.lineSeparator();
    Paragraph paragraph;
    List<Paragraph> paragraphs = new ArrayList<>();
    String interpreterName;
    List<TypeData> typeDataList;

    for (Cell cell : nbformat.getCells()) {
        String status = Result.SUCCESS;
        paragraph = new Paragraph();
        typeDataList = new ArrayList<>();
        Object cellSource = cell.getSource();
        List<String> sourceRaws = new ArrayList<>();

        if (cellSource instanceof String) {
            sourceRaws.add((String) cellSource);
        } else {
            sourceRaws.addAll((List<String>) cellSource);
        }

        List<String> source = Output.verifyEndOfLine(sourceRaws);
        String codeText = Joiner.on("").join(source);

        if (cell instanceof CodeCell) {
            interpreterName = codeReplaced;
            for (Output output : ((CodeCell) cell).getOutputs()) {
                if (output instanceof Error) {
                    typeDataList.add(output.toZeppelinResult());
                } else {
                    typeDataList.add(output.toZeppelinResult());
                    if (output instanceof Stream) {
                        Stream streamOutput = (Stream) output;
                        if (streamOutput.isError()) {
                            status = Result.ERROR;
                        }
                    }
                }
            }
        } else if (cell instanceof MarkdownCell || cell instanceof HeadingCell) {
            interpreterName = markdownReplaced;
            String markdownContent = markdownProcessor.render(codeText);
            typeDataList.add(new TypeData(TypeData.HTML, markdownContent));
            paragraph.setUpMarkdownConfig(true);
        } else {
            interpreterName = "";
        }

        paragraph.setText(interpreterName + lineSeparator + codeText);
        paragraph.setResults(new Result(status, typeDataList));

        paragraphs.add(paragraph);
    }

    note.setParagraphs(paragraphs);

    return note;
}

From source file:com.sdl.odata.client.caller.TracingEndpointCallerTest.java

@Test
public void getInputStream() throws ODataClientException, IOException {
    InputStream stream = caller.getInputStream(singletonMap("Accept", JSON.getType()),
            new URL(basePath + RESPONSE));
    StringBuilder sb = new StringBuilder();
    try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
        String line;//from ww w  . ja  v  a2s  .c  o  m
        while ((line = reader.readLine()) != null) {
            sb.append(line).append(System.lineSeparator());
        }
    }
    assertThat(sb.toString(), equalTo(URLTestUtils.loadTextFile(RESPONSE)));
}

From source file:com.consol.citrus.admin.process.listener.WebSocketProcessListener.java

@Override
public void onProcessStart(String processId) {
    messagingTemplate.convertAndSend(TOPIC_LOG_OUTPUT, SocketEvent.createEvent(processId,
            SocketEvent.PROCESS_START, "process started" + System.lineSeparator()));
}

From source file:at.tugraz.sss.servs.kcprojwiki.impl.SSKCProjWikiImportCommons.java

public String createProject(final SSKCProjWikiConf conf, final SSKCProjWikiVorgang vorgang) throws SSErr {

    try {//from  www .  j av  a2 s.  co  m

        if (!conf.createVorgaenge) {
            return null;
        }

        final String projectTitle = createProjectTitle(vorgang);
        final String editToken = getWikiPageEditToken(conf, projectTitle);
        final List<NameValuePair> postPars = new ArrayList<>();
        final HttpResponse response;
        final HttpPost httpPost = new HttpPost(conf.wikiURI + SSMediaWikiLangE.apiActionEdit + SSStrU.ampersand
                + SSMediaWikiLangE.formatEqualsJson);

        String content = SSStrU.empty;

        httpPost.addHeader(SSMediaWikiLangE.Cookie.toString(), sessionID);

        content += SSStrU.doubleCurlyBracketOpen + SSMediaWikiLangE.Projekt + System.lineSeparator()
                + SSStrU.pipe + SSMediaWikiLangE.ProjectBlankNumber + SSStrU.equal + vorgang.projectNumber
                + System.lineSeparator() + SSStrU.pipe + SSMediaWikiLangE.ProjectBlankName + SSStrU.equal
                + vorgang.projectName + System.lineSeparator() + SSStrU.doubleCurlyBracketClose
                + System.lineSeparator() + "= '''Project Description''' =\n"
                + "<span style=\"color:DARKRED\"> (in case of COMET projects enter description from business plan)</span>\n"
                + "-enter text here- \n" + "= '''Project Status''' =\n"
                + "== <span style=\"color:DARKBLUE\"> '''H1 (January - June)''' ==\n"
                + "<span style=\"color:DARKRED\"> (Enter short summary of project progress here. In case of a COMET project please refer to requirements of business plan!)</span>\n"
                + "-enter text here-\n" + "== <span style=\"color:DARKBLUE\"> '''H2 (July - December)''' ==\n"
                + "<span style=\"color:DARKRED\"> (Enter short summary of project progress here. In case of a COMET project please refer to requirements of business plan!)</span>\n"
                + "-enter text here-\n" + "<headertabs />\n" + "__NOTOC__";

        postPars.add(new BasicNameValuePair(SSMediaWikiLangE.title.toString(), projectTitle));
        postPars.add(new BasicNameValuePair(SSMediaWikiLangE.text.toString(), content.trim()));
        postPars.add(new BasicNameValuePair(SSMediaWikiLangE.token.toString(), editToken));

        httpPost.setEntity(new UrlEncodedFormEntity(postPars));

        response = httpclient.execute(httpPost);

        parseUpdateResponse(response, projectTitle);

        SSLogU.info("created project " + projectTitle + SSStrU.blank + vorgang.projectNumber);

        return projectTitle;
    } catch (Exception error) {
        SSServErrReg.regErrThrow(error);
        return null;
    }
}

From source file:jp.toastkid.script.Controller.java

/**
 * Load script from file./*ww w  .j  a v a 2  s.  co m*/
 * @param file
 */
private void loadScript(final File file) {
    if (file == null || !file.exists()) {
        return;
    }
    try {
        scriptName.setText(file.getCanonicalPath());
        scripterInput.replaceText(
                Files.readAllLines(file.toPath()).stream().collect(Collectors.joining(System.lineSeparator())));
    } catch (final IOException e) {
        LOGGER.error("Caught error.", e);
    }
}

From source file:org.apache.ofbiz.base.start.StartupCommandUtil.java

static final void printOfbizStartupHelp(final PrintStream printStream) {
    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp(new PrintWriter(printStream, true), HelpFormatter.DEFAULT_WIDTH + 6,
            "ofbiz|ofbizDebug|ofbizBackground",
            System.lineSeparator() + "Executes OFBiz command e.g. start, shutdown, check status, etc",
            getOfbizStartupOptions(), HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD,
            "note: Only one command can execute at a time. Portoffset may be appended." + System.lineSeparator()
                    + "Also a command must be invoked separately for each argument e.g."
                    + System.lineSeparator()
                    + "gradlew \"ofbiz --test component=somecomp --test case=somecase\"",
            true);/*w  w  w.j a  v a 2s .c  o  m*/
}

From source file:kmi.taa.core.PredicateObjectRetriever.java

public void execute(String input, String output, String proxy) throws IOException {
    BufferedReader br = null;/*w w w . j a v  a2 s .  co  m*/
    String line = "";
    StringBuilder builder = new StringBuilder();

    try {
        br = new BufferedReader(new FileReader(input));
        System.out.println(System.currentTimeMillis() + ": retrieving predicate links and objects ...");
        Map<Integer, String> originalLines = new LinkedHashMap<>();

        int lineId = 1;
        while ((line = br.readLine()) != null) {
            originalLines.put(lineId++, line);
        }

        System.out.println(System.currentTimeMillis()
                + ": starting multithreaded retrieving predicates and objects on all slinks ...");
        SortedMap<Integer, String> results = retrieveAll(originalLines, proxy);

        for (Integer id : results.keySet()) {
            String result = results.get(id);
            if (!result.equals("")) {
                String[] pairs = result.split(System.getProperty("line.separator"));
                for (String po : pairs) {
                    builder.append(originalLines.get(id) + "\t" + po);
                    builder.append(System.lineSeparator());
                }
            } else {
                builder.append(originalLines.get(id));
                builder.append(System.lineSeparator());
            }

        }
    } finally {
        if (br != null) {
            br.close();
        }
    }

    FileHelper.writeFile(builder.toString(), output, false);
    System.out.println(System.currentTimeMillis() + ": po retrieving completed");
}