Java Code Examples for com.google.common.io.CharStreams#asWriter()
The following examples show how to use
com.google.common.io.CharStreams#asWriter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MapDeltaImpl.java From emodb with Apache License 2.0 | 6 votes |
@Override public void appendTo(Appendable buf) throws IOException { // nested content is sorted so toString() is deterministic. this is valuable in tests and for // comparing hashes of deltas for equality. buf.append('{'); String sep = ""; if (!_removeRest) { buf.append(".."); sep = ","; } Writer writer = CharStreams.asWriter(buf); for (Map.Entry<String, Delta> entry : OrderedJson.ENTRY_COMPARATOR.immutableSortedCopy(_entries.entrySet())) { buf.append(sep); sep = ","; DeltaJson.write(writer, entry.getKey()); buf.append(':'); entry.getValue().appendTo(buf); } buf.append('}'); if (_deleteIfEmpty) { buf.append('?'); } }
Example 2
Source File: LikeConditionImpl.java From emodb with Apache License 2.0 | 5 votes |
@Override public void appendTo(Appendable buf) throws IOException { // Use a writer so the re can be correctly converted to json using DeltaJson. Writer out = CharStreams.asWriter(buf); out.write("like("); DeltaJson.write(out, _condition); out.write(")"); }
Example 3
Source File: IntrinsicConditionImpl.java From emodb with Apache License 2.0 | 5 votes |
@Override public void appendTo(Appendable buf) throws IOException { buf.append("intrinsic("); Writer out = CharStreams.asWriter(buf); DeltaJson.write(out, _name); buf.append(':'); appendSubCondition(buf, _condition); buf.append(')'); }
Example 4
Source File: MapConditionImpl.java From emodb with Apache License 2.0 | 5 votes |
@Override public void appendTo(Appendable buf) throws IOException { buf.append("{.."); Writer writer = CharStreams.asWriter(buf); for (Map.Entry<String, Condition> entry : OrderedJson.ENTRY_COMPARATOR.immutableSortedCopy(_entries.entrySet())) { buf.append(','); DeltaJson.write(writer, entry.getKey()); buf.append(':'); entry.getValue().appendTo(buf); } buf.append('}'); }
Example 5
Source File: ComparisonConditionImpl.java From emodb with Apache License 2.0 | 5 votes |
@Override public void appendTo(Appendable buf) throws IOException { // Use a writer so the value can be correctly converted to json using DeltaJson. Writer out = CharStreams.asWriter(buf); out.write(_comparison.getDeltaFunction()); out.write("("); DeltaJson.write(out, _value); out.write(")"); }
Example 6
Source File: DebugExpressionVisitor.java From immutables with Apache License 2.0 | 4 votes |
public DebugExpressionVisitor(A target) { super(e -> { throw new UnsupportedOperationException(); }); this.target = Objects.requireNonNull(target, "target"); this.writer = new PrintWriter(CharStreams.asWriter(target)); }