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:org.ballerinalang.composer.service.ballerina.launcher.service.LaunchManager.java

private void streamError() {
    try (InputStream inputStream = this.command.getProgram().getErrorStream()) {
        while (this.command != null && this.command.getProgram().isAlive()) {
            String output = consumeStreamOutput(inputStream);
            if (!output.isEmpty()) {
                String[] lines = output.split(System.lineSeparator());
                for (String line : lines) {
                    if (this.command.isErrorOutputEnabled()) {
                        pushMessageToClient(launchSession, LauncherConstants.OUTPUT, LauncherConstants.ERROR,
                                line);//from www  .j a v a  2  s.  c  o m
                    }
                }
            }
        }
    } catch (IOException e) {
        logger.error("Error while sending error stream to client.", e);
    }
}

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

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

    try {/*from  w  w w .  j  a v a2s.co m*/

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

        final String vorgangTitle = createVorgangTitle(vorgang);
        final String editToken = getWikiPageEditToken(conf, vorgangTitle);
        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.ProjektVorgangsebene
                + System.lineSeparator() + SSStrU.pipe + SSMediaWikiLangE.VorgangBlankNumber + SSStrU.equal
                + vorgang.vorgangNumber + System.lineSeparator() + SSStrU.pipe
                + SSMediaWikiLangE.VorgangBlankName + SSStrU.equal + vorgang.vorgangName
                + System.lineSeparator() + SSStrU.pipe + SSMediaWikiLangE.ProjectBlankNumber + SSStrU.equal
                + vorgang.projectNumber + System.lineSeparator() + SSStrU.doubleCurlyBracketClose
                + System.lineSeparator() + "= '''Management & Resources''' =\n"
                + "== <span style=\"color:NAVY\"> '''Which changes in the BMD Data are necessary?''' ==\n"
                + "-enter text here- \n"
                + "== <span style=\"color:NAVY\"> '''Is a shortage of resources (time or personnel) to be expected? If yes: what, when, for how long.''' ==\n"
                + "== <span style=\"color:ROYALBLUE\"> '''---> Any other comments concerning the resource status?''' ==\n"
                + "-enter text here-\n"
                + "== <span style=\"color:NAVY\"> '''Changes concerning participating partners?''' ==\n"
                + "-enter text here-\n"
                + "== <span style=\"color:NAVY\"> '''Changes concerning project content?'''==\n"
                + "-enter text here-\n"
                + "== <span style=\"color: ROYALBLUE\"> '''---> Any other comments concerning management issues?'''==\n"
                + "-enter text here-\n" + "= '''Motivation''' =\n"
                + "== <span style=\"color:NAVY\"> '''Are there issues within the KC-team (co-operation, communication, motivation) that should be addressed?''' ==\n"
                + "-enter text here-\n"
                + "== <span style=\"color:NAVY\"> '''What are the reasons and what could be done to solve the issues?''' ==\n"
                + "-enter text here-\n"
                + "== <span style=\"color:ROYALBLUE\"> ''' ---> Any other comments concerning the motivation within KC?''' ==\n"
                + "-enter text here-\n"
                + "== <span style=\"color:NAVY\"> '''Are there issues concerning the communication with the partners that should be addressed?''' ==\n"
                + "-enter text here-\n"
                + "== <span style=\"color:NAVY\"> '''Are there issues concerning the co-operation (data exchange, work done by partners, ...) with the partners that should be addressed?'''==\n"
                + "-enter text here-\n"
                + "== <span style=\"color:ROYALBLUE\"> '''---> Any other comments concerning the motivation of the project partners?''' ==\n"
                + "-enter text here-\n" + "= '''Project results''' =\n"
                + "== <span style=\"color:NAVY\"> '''What has happened within the project?'''==\n"
                + "-enter text here-\n"
                + "== <span style=\"color:NAVY\"> '''Have any important goals, milestones, etc. been reached?'''==\n"
                + "<span style=\"color:FORESTGREEN\"> Please add the '''month''' in which they were reached! </span>\n"
                + "-enter text here-\n"
                + "== <span style=\"color:NAVY\"> '''Did any special results and achievements take place (e.g. highlights, prototypes, products, ...)''' ==\n"
                + "<span style=\"color:FORESTGREEN\"> Please add the '''month''' in which they took place! </span>\n"
                + "-enter text here-\n"
                + "== <span style=\"color:NAVY\"> '''Were any important workshops or meetings organised?''' ==\n"
                + "<span style=\"color:FORESTGREEN\"> Please add the '''month''' in which they took place! </span>\n"
                + "-enter text here-\n"
                + "== <span style=\"color:NAVY\"> '''Check with defined risks: Is attention needed anywhere?''' ==\n"
                + "<span style=\"color:FORESTGREEN\"> Please add the relevant '''month'''! </span>\n"
                + "-enter text here-\n"
                + "== <span style=\"color:NAVY\"> '''---> Any other comments concerning project results?''' ==\n"
                + "-enter text here-\n" + "<headertabs />\n" + "__NOTOC__";

        postPars.add(new BasicNameValuePair(SSMediaWikiLangE.title.toString(), vorgangTitle));
        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, vorgangTitle);

        SSLogU.info("created vorgang " + vorgangTitle + SSStrU.blank + vorgang.vorgangNumber);

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

From source file:com.redhat.jenkins.nodesharing.NodeSharingJenkinsRule.java

public void makeJthAnOrchestrator(Jenkins jenkins, GitClient git) throws IOException, InterruptedException {
    git.getWorkTree().child("config").write(
            "orchestrator.url=" + jenkins.getRootUrl() + System.lineSeparator() + "enforce_https=false",
            "UTF-8");
    git.add("config");
    git.commit("Writing config repo config");
}

From source file:org.assertj.maven.generator.AssertionsGeneratorReport.java

private void buildGeneratorParametersReport(StringBuilder reportBuilder) {
    reportBuilder.append(System.lineSeparator());
    reportBuilder.append(SECTION_START).append("Generator input parameters").append(SECTION_END)
            .append(System.lineSeparator());
    if (isNotEmpty(userTemplates)) {
        reportBuilder.append(//from w  ww.  j  ava2  s.c o  m
                "The following templates will replace the ones provided by AssertJ when generating AssertJ assertions :\n");
        for (String inputPackage : userTemplates) {
            reportBuilder.append(INDENT).append(inputPackage).append(System.lineSeparator());
        }
        reportBuilder.append(System.lineSeparator());
    }
    if (isNotEmpty(inputPackages)) {
        reportBuilder
                .append("Generating AssertJ assertions for classes in following packages and subpackages:\n");
        for (String inputPackage : inputPackages) {
            reportBuilder.append(INDENT).append(inputPackage).append(System.lineSeparator());
        }
    }
    if (isNotEmpty(inputClasses)) {
        if (isNotEmpty(inputPackages)) {
            reportBuilder.append(System.lineSeparator());
        }
        reportBuilder.append("Generating AssertJ assertions for classes:\n");
        for (String inputClass : inputClasses) {
            reportBuilder.append(INDENT).append(inputClass).append(System.lineSeparator());
        }
    }
    if (isNotEmpty(excludedClassesFromAssertionGeneration)) {
        reportBuilder.append(System.lineSeparator());
        reportBuilder.append("Input classes excluded from assertions generation:\n");
        for (Class<?> excludedClass : excludedClassesFromAssertionGeneration) {
            reportBuilder.append(INDENT).append(excludedClass.getName()).append(System.lineSeparator());
        }
    }
}

From source file:org.openlmis.fulfillment.service.OrderCsvHelperTest.java

@Test
public void shouldIncludeZeroQuantityLineItemsIfConfiguredSo() throws IOException {
    ReflectionTestUtils.setField(orderCsvHelper, "includeZeroQuantity", true);

    List<OrderFileColumn> orderFileColumns = new ArrayList<>();
    orderFileColumns.add(new OrderFileColumn(true, HEADER_ORDERABLE, PRODUCT, true, 1, null, LINE_ITEM,
            ORDERABLE, null, null, null));

    OrderFileTemplate orderFileTemplate = new OrderFileTemplate("O", false, orderFileColumns);

    String csv = writeCsvFile(order, orderFileTemplate);
    int numberOfLines = csv.split(System.lineSeparator()).length;

    assertThat(numberOfLines, is(2));/*from w  ww.j av  a2s.  com*/
}

From source file:org.apache.reef.runtime.yarn.driver.restart.DFSEvaluatorPreserver.java

/**
 * Adds the allocated evaluator entry to the evaluator log.
 * @param id//from w  w w  .j a va 2 s . c o m
 */
@Override
public synchronized void recordAllocatedEvaluator(final String id) {
    if (this.fileSystem != null && this.changeLogLocation != null) {
        final String entry = ADD_FLAG + id + System.lineSeparator();
        this.logContainerChange(entry);
    }
}

From source file:com.firewallid.termcloud.TermCloud.java

public void saveTermCloudAll(JavaPairRDD<String, List<Tuple2<String, Double>>> doc, String fileNamePrefix)
        throws IOException {
    List<Tuple2<String, List<Tuple2<String, Double>>>> collectDoc = doc.collect();

    if (collectDoc.isEmpty()) {
        return;/*ww w  . ja v a  2s. c om*/
    }

    /* Reduced feature-value list */
    List<Tuple2<String, Double>> featureValueList = collectDoc.parallelStream()
            .map(titleFeatures -> titleFeatures._2).reduce((featureValueList1, featureValueList2) -> {
                List<Tuple2<String, Double>> combineList = FIUtils.combineList(featureValueList1,
                        featureValueList2);

                List<Tuple2<String, Double>> collect = combineList.parallelStream()
                        .collect(Collectors
                                .groupingBy(t -> t._1, Collectors.mapping(t -> t._2, Collectors.toList())))
                        .entrySet().parallelStream()
                        .map(t -> new Tuple2<String, Double>(t.getKey(),
                                t.getValue().parallelStream().mapToDouble(Double::doubleValue).sum()))
                        .collect(Collectors.toList());

                return collect;
            }).get();

    /* Sorting */
    List<Tuple2<String, Double>> featureValueListSorted = FIUtils.sortDescTupleListByValue(featureValueList);

    /* Top N */
    List<Tuple2<String, Double>> featureValueListTopN;
    if (featureValueListSorted.size() <= conf.getInt(TOPN, 100)) {
        featureValueListTopN = new ArrayList<>(featureValueListSorted);
    } else {
        featureValueListTopN = new ArrayList<>(featureValueListSorted.subList(0, conf.getInt(TOPN, 100)));
    }

    /* Text for file. One line, one feature-value pair */
    String featureValueText = featureValueListTopN.parallelStream()
            .map(feature -> feature._1 + StringEscapeUtils.unescapeJava(conf.get(LINE_DELIMITER)) + feature._2)
            .collect(Collectors.joining(System.lineSeparator()));

    /* Save to file */
    FIFile.writeStringToHDFSFile(FIFile.generateFullPath(conf.get(TERMCLOUD_FOLDER),
            createFileNameTermCloud(fileNamePrefix, conf.get(ALLNAME))), featureValueText);
}

From source file:com.qwazr.utils.StringUtils.java

/**
 * Split the string by line separator//from  ww w .j a  v  a2  s.  co  m
 *
 * @param str the string to split
 * @return an array with one item per line
 */
public static String[] splitLines(String str) {
    return split(str, System.lineSeparator());
}

From source file:jlg.jade.test.asterix.cat062.Cat062LargeSampleTest.java

@Test
@Description("Used only for printing byte information that can help with developing the tool")
@Ignore/*from   ww  w. j av a  2s  .  c  om*/
public void with_one_packet_should_print_bytes() throws IOException {
    try (InputStream is = TestHelper.getFileInputStreamFromResource("final_frame_062_one_packet_sample2.FF")) {
        FinalFrameReader ffReader = new FinalFrameReader();
        while (is.available() > 0) {
            byte[] ffPayload = ffReader.read(is);
            if (ffPayload != null) {
                System.out.println("DATA BLOCK START");
                for (int i = 0; i < ffPayload.length; i++) {
                    BitSet bs = BitSet.valueOf(new byte[] { ffPayload[i] });
                    System.out.print("ORIGINAL [ ");
                    for (int j = 0; j < 8; j++) {
                        if (bs.get(j)) {
                            System.out.print(1 + " ");
                        } else {
                            System.out.print(0 + " ");
                        }
                    }
                    System.out.print("]");

                    System.out.print("   REVERSE [ ");
                    for (int j = 8; j > 0; j--) {
                        if (bs.get(j)) {
                            System.out.print(1 + " ");
                        } else {
                            System.out.print(0 + " ");
                        }
                    }
                    System.out.print("]   ");
                    int unsignedValue = Byte.toUnsignedInt(ffPayload[i]);

                    System.out.println(unsignedValue);

                    if (i == 0 || i == 2) {
                        System.out.println("----------------------------------------------------------------");
                    }
                }
            }
            System.out.println("DATA BLOCK END");
            System.out.println(System.lineSeparator());
        }
    }
}

From source file:com.provenance.cloudprovenance.policyhandler.ws.controler.PolicyRequestHandler.java

public String getTemplateProvFile() {

    BufferedReader br = null;//w  ww .j a va 2s . com

    InputStream is = (getClass().getClassLoader().getResourceAsStream("templateTraceabilityfile.xml"));

    try {
        br = new BufferedReader(new InputStreamReader(is));
        StringBuilder sb = new StringBuilder();
        String line = br.readLine();

        while (line != null) {
            sb.append(line);
            sb.append(System.lineSeparator());
            line = br.readLine();
        }

        logger.info(sb.toString());
        return sb.toString();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    finally {
        try {
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return null;
}