Example usage for com.google.common.base StandardSystemProperty LINE_SEPARATOR

List of usage examples for com.google.common.base StandardSystemProperty LINE_SEPARATOR

Introduction

In this page you can find the example usage for com.google.common.base StandardSystemProperty LINE_SEPARATOR.

Prototype

StandardSystemProperty LINE_SEPARATOR

To view the source code for com.google.common.base StandardSystemProperty LINE_SEPARATOR.

Click Source Link

Document

Line separator ("\n" on UNIX).

Usage

From source file:com.palantir.typescript.services.language.SymbolDisplayPart.java

public static String getText(List<SymbolDisplayPart> parts) {
    checkNotNull(parts);//from w ww  .j  a  v  a 2s  .  co m

    StringBuilder displayText = new StringBuilder();

    for (SymbolDisplayPart part : parts) {
        if (part.getKind().equals(SymbolDisplayPartKind.LINE_BREAK)) {
            displayText.append(StandardSystemProperty.LINE_SEPARATOR.value());
        } else {
            displayText.append(part.getText());
        }
    }

    return displayText.toString();
}

From source file:br.com.objectos.testing.MatcherToStringEqualToResource.java

List<String> readLines(T object) throws Exception {
    String string = object != null ? object.toString() : "";
    return Splitter.on(StandardSystemProperty.LINE_SEPARATOR.value()).splitToList(string);
}

From source file:com.facebook.buck.maven.Publisher.java

public ImmutableSet<DeployResult> publish(ImmutableSet<MavenPublishable> publishables)
        throws DeploymentException {
    ImmutableListMultimap<UnflavoredBuildTarget, UnflavoredBuildTarget> duplicateBuiltinBuileRules = checkForDuplicatePackagedDeps(
            publishables);/*from  w w  w .j av  a 2 s .  c  om*/
    if (duplicateBuiltinBuileRules.size() > 0) {
        StringBuilder sb = new StringBuilder();
        sb.append("Duplicate transitive dependencies for publishable libraries found!  This means");
        sb.append(StandardSystemProperty.LINE_SEPARATOR);
        sb.append("that the following libraries would have multiple copies if these libraries were");
        sb.append(StandardSystemProperty.LINE_SEPARATOR);
        sb.append("used together.  The can be resolved by adding a maven URL to each target listed");
        sb.append(StandardSystemProperty.LINE_SEPARATOR);
        sb.append("below:");
        for (UnflavoredBuildTarget unflavoredBuildTarget : duplicateBuiltinBuileRules.keySet()) {
            sb.append(StandardSystemProperty.LINE_SEPARATOR);
            sb.append(unflavoredBuildTarget.getFullyQualifiedName());
            sb.append(" (referenced by these build targets: ");
            Joiner.on(", ").appendTo(sb, duplicateBuiltinBuileRules.get(unflavoredBuildTarget));
            sb.append(")");
        }
        throw new DeploymentException(sb.toString());
    }

    ImmutableSet.Builder<DeployResult> deployResultBuilder = ImmutableSet.builder();
    for (MavenPublishable publishable : publishables) {
        DefaultArtifact coords = new DefaultArtifact(
                Preconditions.checkNotNull(publishable.getMavenCoords().get(),
                        "No maven coordinates specified for published rule ", publishable));
        Path relativePathToOutput = Preconditions.checkNotNull(publishable.getPathToOutput(),
                "No path to output present in ", publishable);
        File mainItem = publishable.getProjectFilesystem().resolve(relativePathToOutput).toFile();

        if (!coords.getClassifier().isEmpty()) {
            deployResultBuilder.add(publish(coords, ImmutableList.of(mainItem)));
        }

        try {
            // If this is the "main" artifact (denoted by lack of classifier) generate and publish
            // pom alongside
            File pom = Pom.generatePomFile(publishable).toFile();
            deployResultBuilder.add(publish(coords, ImmutableList.of(mainItem, pom)));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
    return deployResultBuilder.build();
}

From source file:org.apache.jackrabbit.oak.plugins.document.mongo.MongoVersionGCSupport.java

private void logSplitDocIdsTobeDeleted(DBObject query) {
    // Fetch only the id
    final BasicDBObject keys = new BasicDBObject(Document.ID, 1);
    List<String> ids;
    DBCursor cursor = getNodeCollection().find(query, keys)
            .setReadPreference(store.getConfiguredReadPreference(NODES));
    try {/*from   ww  w.j a va 2 s  . c  o  m*/
        ids = ImmutableList.copyOf(Iterables.transform(cursor, new Function<DBObject, String>() {
            @Override
            public String apply(DBObject input) {
                return (String) input.get(Document.ID);
            }
        }));
    } finally {
        cursor.close();
    }
    StringBuilder sb = new StringBuilder("Split documents with following ids were deleted as part of GC \n");
    Joiner.on(StandardSystemProperty.LINE_SEPARATOR.value()).appendTo(sb, ids);
    LOG.debug(sb.toString());
}

From source file:org.gradle.internal.operations.trace.BuildOperationTrace.java

private void writeSummaryTree(final List<BuildOperationRecord> roots) throws IOException {
    Files.asCharSink(file(basePath, "-tree.txt"), Charsets.UTF_8).writeLines(new Iterable<String>() {
        @Override/*from   ww  w .j av  a  2s  .  c o  m*/
        @Nonnull
        public Iterator<String> iterator() {

            final Deque<Queue<BuildOperationRecord>> stack = new ArrayDeque<Queue<BuildOperationRecord>>(
                    Collections.singleton(new ArrayDeque<BuildOperationRecord>(roots)));
            final StringBuilder stringBuilder = new StringBuilder();

            return new Iterator<String>() {
                @Override
                public boolean hasNext() {
                    if (stack.isEmpty()) {
                        return false;
                    } else if (stack.peek().isEmpty()) {
                        stack.pop();
                        return hasNext();
                    } else {
                        return true;
                    }
                }

                @Override
                public String next() {
                    Queue<BuildOperationRecord> children = stack.peek();
                    BuildOperationRecord record = children.poll();

                    stringBuilder.setLength(0);

                    int indents = stack.size() - 1;

                    for (int i = 0; i < indents; ++i) {
                        stringBuilder.append("  ");
                    }

                    if (!record.children.isEmpty()) {
                        stack.addFirst(new ArrayDeque<BuildOperationRecord>(record.children));
                    }

                    stringBuilder.append(record.displayName);

                    if (record.details != null) {
                        stringBuilder.append(" ");
                        stringBuilder.append(JsonOutput.toJson(record.details));
                    }

                    if (record.result != null) {
                        stringBuilder.append(" ");
                        stringBuilder.append(JsonOutput.toJson(record.result));
                    }

                    stringBuilder.append(" [");
                    stringBuilder.append(record.endTime - record.startTime);
                    stringBuilder.append("ms]");

                    stringBuilder.append(" (");
                    stringBuilder.append(record.id);
                    stringBuilder.append(")");

                    if (!record.progress.isEmpty()) {
                        for (BuildOperationRecord.Progress progress : record.progress) {
                            stringBuilder.append(StandardSystemProperty.LINE_SEPARATOR.value());
                            for (int i = 0; i < indents; ++i) {
                                stringBuilder.append("  ");
                            }
                            stringBuilder.append("- ").append(progress.details).append(" [")
                                    .append(progress.time - record.startTime).append("]");
                        }
                    }

                    return stringBuilder.toString();
                }

                @Override
                public void remove() {
                    throw new UnsupportedOperationException();
                }
            };
        }
    });
}

From source file:org.n52.sos.encode.XmlWriter.java

/**
 * Write new line to stream//w w w .jav  a2 s. c o m
 *
 * @throws XMLStreamException
 *             If an error occurs when writing to {@link OutputStream}
 */
protected void writeNewLine() throws XMLStreamException {
    chars(StandardSystemProperty.LINE_SEPARATOR.value());
    flush();
}