Example usage for org.apache.commons.lang SystemUtils LINE_SEPARATOR

List of usage examples for org.apache.commons.lang SystemUtils LINE_SEPARATOR

Introduction

In this page you can find the example usage for org.apache.commons.lang SystemUtils LINE_SEPARATOR.

Prototype

String LINE_SEPARATOR

To view the source code for org.apache.commons.lang SystemUtils LINE_SEPARATOR.

Click Source Link

Document

The line.separator System Property.

Usage

From source file:com.akjava.wiki.client.keyword.KeyWordUtils.java

public static Keyword[] loadCsvKeyWord(Reader reader) {
    List<Keyword> list = new ArrayList<Keyword>();
    String text;/*from  w w  w .j  a  va2s .c  o  m*/
    try {
        text = IOUtils.toString(reader);
        String line[] = text.split(SystemUtils.LINE_SEPARATOR);
        for (int i = 0; i < line.length; i++) {
            String word[] = line[i].split(",");
            if (word.length > 1) {
                Keyword key = new Keyword(word[0], word[1]);
                if (word.length > 2) {
                    key.setIcon(word[2].trim());
                }
                list.add(key);
            } else if (word.length == 1) {
                String w = word[0];
                if (!w.startsWith("<") && !w.isEmpty()) {//ignore tag & empty
                    Keyword key = new Keyword(w, "");
                    list.add(key);
                }

            }

        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    Keyword[] keywords = (Keyword[]) list.toArray(new Keyword[list.size()]);
    Arrays.sort(keywords);

    return keywords;
}

From source file:com.vmware.identity.interop.vmafd.VmAfdException.java

@Override
public String toString() {
    return super.toString() + SystemUtils.LINE_SEPARATOR
            + String.format("VmAfd error [code: %d]", this._errCode);
}

From source file:com.vmware.identity.interop.directory.DirectoryException.java

@Override
public String toString() {
    return super.toString() + SystemUtils.LINE_SEPARATOR
            + String.format("VMware Directory error [code: %d]", this._errCode);
}

From source file:com.vmware.identity.interop.accountmanager.AccountLockedOutException.java

@Override
public String toString() {
    return super.toString() + SystemUtils.LINE_SEPARATOR
            + String.format("DomainManager error [code: %d]", this._errCode);
}

From source file:com.vmware.identity.interop.ldap.LdapException.java

@Override
public String toString() {
    return super.toString() + SystemUtils.LINE_SEPARATOR
            + String.format("LDAP error [code: %d]", this._errCode);
}

From source file:com.fusesource.test.ResourceHelper.java

public String getResourceAsString(String fileName) throws IOException {
    Validate.notEmpty(fileName, "fileName is empty");
    InputStream inputStream = testClass.getResourceAsStream(fileName);
    if (inputStream == null) {
        throw new RuntimeException("Could not find " + fileName);
    }/*from   w w  w.  java 2s. com*/
    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
    StringBuilder out = new StringBuilder();
    while (true) {
        String line = bufferedReader.readLine();
        if (line == null) {
            break;
        } else {
            out.append(line + SystemUtils.LINE_SEPARATOR);
        }
    }
    return out.toString();
}

From source file:au.com.dw.testdatacapturej.builder.MethodBuilderTest.java

/**
 * Test for simple class as param 1/*from   w w  w  .  j  a  v a 2  s  .c om*/
 */
@Test
public void testCreateMethodLineForStringParam1() {
    MethodBuilder builder = new MethodBuilder();
    String result = builder.createMethodLine("org.test.DummyClass.dummyMethod", "test", 1);
    System.out.println(result);

    String expected = "public java.lang.String createParam1String_org_test_DummyClass_dummyMethod() {"
            + SystemUtils.LINE_SEPARATOR;
    assertEquals(expected, result);
}

From source file:com.alibaba.otter.shared.common.utils.version.VersionInfo.java

/**
 * Returns the buildVersion which includes version, revision, user and date.
 *//* w  ww.  j  a va 2 s  . c om*/
public static String getBuildVersion() {
    StringBuilder buf = new StringBuilder();

    buf.append(SystemUtils.LINE_SEPARATOR);
    buf.append("[OTTER Version Info]").append(SystemUtils.LINE_SEPARATOR);
    buf.append("[version ]").append(VersionInfo.getVersion()).append(SystemUtils.LINE_SEPARATOR);
    buf.append("[revision]").append(VersionInfo.getRevision()).append(SystemUtils.LINE_SEPARATOR);
    buf.append("[compiler]").append(VersionInfo.getUser()).append(SystemUtils.LINE_SEPARATOR);
    buf.append("[date    ]").append(VersionInfo.getDate()).append(SystemUtils.LINE_SEPARATOR);
    buf.append("[checksum]").append(VersionInfo.getSrcChecksum()).append(SystemUtils.LINE_SEPARATOR);
    buf.append("[branch  ]").append(VersionInfo.getBranch()).append(SystemUtils.LINE_SEPARATOR);
    buf.append("[url     ]").append(VersionInfo.getUrl()).append(SystemUtils.LINE_SEPARATOR);

    return buf.toString();
}

From source file:com.googlecode.markuputils.CssStyleBuilder.java

/**
 * Appends new line to this builder./*from w  w w . j  a  v  a2  s . c o m*/
 * 
 * @return a reference to this builder.
 */
public CssStyleBuilder appendNewLine() {

    buffer.append(SystemUtils.LINE_SEPARATOR);

    return this;
}

From source file:com.alibaba.otter.node.etl.common.io.download.impl.aria2c.Aria2cDownload.java

protected void analyzeResult(Exec.Result result) {
    String[] results = StringUtils.split(result.getStdout(), SystemUtils.LINE_SEPARATOR);
    List<Aria2cStat> segmentStat = new ArrayList<Aria2cStat>();
    int pos = 0;/*  ww w  . ja va2 s .c  o m*/

    for (; pos < results.length; pos++) {
        if (true == results[pos].toLowerCase().startsWith("gid|stat")) {
            break;
        }
    }

    for (pos++; pos < results.length; pos++) {
        // ?
        // Download Results:
        // gid|stat|avg speed  |path/URI
        // ===+====+===========+===========================================================
        // 1|  OK| 103.7KiB/s|./index.html
        //
        // Status Legend:
        // (OK):download completed.
        if (true == StringUtils.isNumeric(results[pos].substring(0, 1))) {

            // ?????
            String[] status = StringUtils.split(results[pos], " \t|");

            if (status.length > 2) {
                if (StringUtils.equalsIgnoreCase(Aria2cStat.OK.name(), status[1])) {
                    segmentStat.add(Aria2cStat.OK);
                } else if (StringUtils.equalsIgnoreCase(Aria2cStat.ERR.name(), status[1])) {
                    segmentStat.add(Aria2cStat.ERR);
                } else if (StringUtils.equalsIgnoreCase(Aria2cStat.INPR.name(), status[1])) {
                    segmentStat.add(Aria2cStat.INPR);
                }

                logger.warn(results[pos]);
            } else {
                logger.error("it seems aria2 changed it's status format: " + results[pos]);
            }
        }
    }

    int size = segmentStat.size();
    int errCount = 0;
    int inprCount = 0;
    for (int i = 0; i < size; i++) {
        final Aria2cStat stat = segmentStat.get(i);

        if (Aria2cStat.ERR == stat) {
            errCount++;
        } else if (Aria2cStat.INPR == stat) {
            inprCount++;
        }
    }

    // ???
    if (errCount == 0) {
        if (inprCount == 0) {
            // ?
            completed.set(true);
        } else {
            // ?
            paused.set(true);
        }
    } else {
        if (errCount == size) {
            // ?
            aborted.set(true);
        } else {
            // ??
            paused.set(true);
        }
    }
}