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:glluch.com.ontotaxoseeker.TestsGen.java

public static String save(Object o, String className) throws FileNotFoundException, IOException {

    if (StringUtils.isEmpty(className)) {
        Out.p("TestsGen.save have received an anonomous object");
        className = "anonimousClass";
    }//from  w w  w  .j av  a 2  s .com

    FileOutputStream fileOut = new FileOutputStream("resources/test/" + className + ".ser");
    ObjectOutputStream out = new ObjectOutputStream(fileOut);
    out.writeObject(o);
    out.close();
    fileOut.close();
    System.out.printf(
            "Serialized data is saved in " + "resources/test/" + className + ".ser" + System.lineSeparator());

    return "resources/test/" + className + ".ser";
}

From source file:com.ibm.idreambooks.BookReview.java

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

    for (CriticReview r : reviews) {
        sb.append(r.toString());/*from  w ww .  j av  a  2 s .  c  o m*/
        sb.append(System.lineSeparator());
    }

    return sb.toString();
}

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

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

    for (BookInformation b : bookInformation) {
        sb.append(b.toString());//from www  . j av a 2 s.  c  o  m
        sb.append(System.lineSeparator());
    }

    return sb.toString();
}

From source file:NewlineOutputStream.java

public NewlineOutputStream(OutputStream os) {
    super(os);/*from  ww w  .j a  v  a  2 s . c o  m*/
    if (newline == null) {
        String s = System.lineSeparator();
        if (s == null || s.length() <= 0)
            s = "\n";
        try {
            newline = s.getBytes("iso-8859-1"); // really us-ascii
        } catch (UnsupportedEncodingException ex) {
            // should never happen
            newline = new byte[] { (byte) '\n' };
        }
    }
}

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

@Test
public void testWriteValueWithIndent() throws Exception {
    file = File.createTempFile("tmp", null);
    JSONUtils.writeValueWithIndent(file, data);

    String result = FileUtils.readFileToString(file);
    assertThat(result.split(System.lineSeparator()), is(new String[] { "{", "  \"a\" : \"b\"", "}" }));
}

From source file:jobhunter.infoempleo.Client.java

public Job execute() throws IOException, URISyntaxException {
    l.debug("Connecting to {}", url);

    update("Connecting", 1L);
    final Document doc = Jsoup.connect(url).get();

    update("Parsing HTML", 2L);
    final Job job = Job.of();

    job.setPortal(InfoEmpleoWebPlugin.portal);
    job.setLink(url);//from  w  w w  .  j a  v a2s  .c  o  m
    job.setExtId("");

    final StringBuilder description = new StringBuilder();

    doc.getElementsByClass("linea").forEach(td -> {
        td.getElementsByTag("p").forEach(p -> {
            description.append(StringEscapeUtils.unescapeHtml4(p.html())).append(System.lineSeparator());
        });
    });

    job.setDescription(description.toString());

    job.setPosition(doc.getElementById("ctl00_CPH_Body_Link_Subtitulo").attr("title"));

    job.getCompany().setName(getCompany(doc));

    final String href = doc.getElementById("ctl00_CPH_Body_lnkEnviarAmigoI").attr("href");

    final String extId = URLEncodedUtils.parse(new URI(href), "UTF-8").stream()
            .filter(nvp -> nvp.getName().equalsIgnoreCase("Id_Oferta")).findFirst().get().getValue();

    job.setExtId(extId);

    update("Done", 3L);
    return job;
}

From source file:org.apache.kylin.tool.KylinConfigCLITest.java

@Test
public void testGetPrefix() throws IOException {
    PrintStream o = System.out;
    File f = File.createTempFile("cfg", ".tmp");
    PrintStream tmpOut = new PrintStream(new FileOutputStream(f));
    System.setOut(tmpOut);//from w  ww  . jav a 2  s  . c o m
    KylinConfigCLI.main(new String[] { "kylin.cube.engine." });

    String val = FileUtils.readFileToString(f, Charset.defaultCharset()).trim();
    assertEquals("2=org.apache.kylin.engine.mr.MRBatchCubingEngine2" + System.lineSeparator()
            + "0=org.apache.kylin.engine.mr.MRBatchCubingEngine", val);

    tmpOut.close();
    FileUtils.forceDelete(f);
    System.setOut(o);
}

From source file:com.camel.crawler.WebCrawler.java

/**
 * ???/*w w w . j  av  a 2  s . c  o m*/
 * @param webpage
 */
public void extraInfo(String webpage) {
    Matcher matcher = emailPattern.matcher(webpage);
    if (matcher.find()) {
        String email = matcher.group(2);
        if (!StringUtils.isEmpty(email)) {
            System.out.println("find email=" + email);
            FileUtils.writeAppendFile(emailFile, email.trim() + System.lineSeparator());
        } else {
            System.out.println("empty email address");
        }
    }
}

From source file:com.sdfl.compiler.sql.statement.ConditionGroupSQLCodeGenerator.java

private void buildConditionGroup(List<Condition> pConditionsInGroup, int pIndentLevel) {

    for (int lCurConditionIdx = 0; lCurConditionIdx < pConditionsInGroup.size(); lCurConditionIdx++) {

        Condition lCurCondition = pConditionsInGroup.get(lCurConditionIdx);
        if (lCurCondition instanceof Assertion) {
            this.buildAssertion(lCurCondition);
        } else if (lCurCondition instanceof ConditionGroup) {
            this.builder.append("(");
            this.buildConditionGroup(((ConditionGroup) lCurCondition).getConditions(), pIndentLevel + 1);
            this.builder.append(")");
        }/*  w  w  w .  j  a  v  a2  s  .c om*/

        this.appendIfNotLast(System.lineSeparator(), pConditionsInGroup.size(), lCurConditionIdx);
        this.addRelationKeywordIfNecessary(pIndentLevel, lCurCondition);
    }
}

From source file:org.bonitasoft.console.common.server.themes.CompilableFileTest.java

@Test
public void should_add_compiled_file_to_compile_less_into_css() throws Exception {
    final File lessStyle = directory.newFile("style.less");
    given(modifier.resolve("style.less")).willReturn(lessStyle);

    new CompilableFile("style.less", "style.css").compile(modifier);
    final byte[] emptyExpectedFile = System.lineSeparator().getBytes();

    verify(modifier).add("style.css", emptyExpectedFile);
}