aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/genquery
diff options
context:
space:
mode:
authorGravatar Michajlo Matijkiw <michajlo@google.com>2016-09-29 18:04:53 +0000
committerGravatar Yun Peng <pcloudy@google.com>2016-09-30 08:12:41 +0000
commit1cbf12f68c80440fe6335900a5da5ef6e6fd3cfa (patch)
tree5417037e6bc34d497c771ec9d5a826fae92d7348 /src/main/java/com/google/devtools/build/lib/rules/genquery
parentf4612304c23070aa32a87a9eebb682c30e0f0ab2 (diff)
Don't force PrintStream on streaming output formatters
Usually an OutputStream will do. Forgo the extra layer of indirection and stream directly to the output. -- MOS_MIGRATED_REVID=134682243
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/genquery')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java b/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java
index 849238a44a..3620b8fbda 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java
@@ -81,7 +81,6 @@ import com.google.devtools.common.options.OptionsParsingException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-import java.io.PrintStream;
import java.nio.channels.ClosedByInterruptException;
import java.util.Collection;
import java.util.HashSet;
@@ -309,18 +308,15 @@ public class GenQuery implements RuleConfiguredTargetFactory {
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- PrintStream printStream = new PrintStream(outputStream);
-
try {
QueryOutputUtils
- .output(queryOptions, queryResult, targets.getResult(), formatter, printStream,
+ .output(queryOptions, queryResult, targets.getResult(), formatter, outputStream,
queryOptions.aspectDeps.createResolver(packageProvider, getEventHandler(ruleContext)));
} catch (ClosedByInterruptException e) {
throw new InterruptedException(e.getMessage());
} catch (IOException e) {
throw new RuntimeException(e);
}
- printStream.flush();
return outputStream.toByteArray();
}