use of java.io.OutputStreamWriter in project checkstyle by checkstyle.
the class XMLLogger method setOutputStream.
/**
* Sets the OutputStream.
* @param outputStream the OutputStream to use
**/
private void setOutputStream(OutputStream outputStream) {
final OutputStreamWriter osw = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8);
writer = new PrintWriter(osw);
}
use of java.io.OutputStreamWriter in project buck by facebook.
the class GenerateCodeCoverageReportStep method saveParametersToPropertyStream.
@VisibleForTesting
void saveParametersToPropertyStream(ProjectFilesystem filesystem, Set<Path> extractedClassesDirectories, OutputStream outputStream) throws IOException {
final Properties properties = new Properties();
properties.setProperty("jacoco.output.dir", filesystem.resolve(outputDirectory).toString());
properties.setProperty("jacoco.exec.data.file", JACOCO_EXEC_COVERAGE_FILE);
properties.setProperty("jacoco.format", format.toString().toLowerCase());
properties.setProperty("jacoco.title", title);
properties.setProperty("classes.jars", formatPathSet(jarFiles));
properties.setProperty("classes.dir", formatPathSet(extractedClassesDirectories));
properties.setProperty("src.dir", Joiner.on(":").join(sourceDirectories));
if (coverageIncludes.isPresent()) {
properties.setProperty("jacoco.includes", coverageIncludes.get());
}
if (coverageExcludes.isPresent()) {
properties.setProperty("jacoco.excludes", coverageExcludes.get());
}
try (Writer writer = new OutputStreamWriter(outputStream, "utf8")) {
properties.store(writer, "Parameters for Jacoco report generator.");
}
}
use of java.io.OutputStreamWriter in project buck by facebook.
the class WorkerProcess method ensureLaunchAndHandshake.
public synchronized void ensureLaunchAndHandshake() throws IOException {
if (handshakePerformed) {
return;
}
LOG.debug("Starting up process %d using command: \'%s\'", this.hashCode(), Joiner.on(' ').join(processParams.getCommand()));
launchedProcess = executor.launchProcess(processParams);
JsonWriter processStdinWriter = new JsonWriter(new BufferedWriter(new OutputStreamWriter(launchedProcess.getOutputStream())));
JsonReader processStdoutReader = new JsonReader(new BufferedReader(new InputStreamReader(launchedProcess.getInputStream())));
protocol = new WorkerProcessProtocolZero(executor, launchedProcess, processStdinWriter, processStdoutReader, stdErr);
int messageID = currentMessageID.getAndAdd(1);
LOG.debug("Sending handshake to process %d", this.hashCode());
protocol.sendHandshake(messageID);
LOG.debug("Receiving handshake from process %d", this.hashCode());
protocol.receiveHandshake(messageID);
handshakePerformed = true;
}
use of java.io.OutputStreamWriter in project pinot by linkedin.
the class ControllerTest method postQuery.
public JSONObject postQuery(String query, String brokerBaseApiUrl) throws Exception {
final JSONObject json = new JSONObject();
json.put("pql", query);
json.put("trace", isTraceEnabled);
// json.put("debugOptions", "routingOptions=FORCE_LLC,FORCE_HLC;otherOption=foo,bar");
final long start = System.currentTimeMillis();
final URLConnection conn = new URL(brokerBaseApiUrl + "/query").openConnection();
conn.setDoOutput(true);
final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream(), "UTF-8"));
final String reqStr = json.toString();
writer.write(reqStr, 0, reqStr.length());
writer.flush();
JSONObject ret = getBrokerReturnJson(conn);
final long stop = System.currentTimeMillis();
LOGGER.debug("Time taken for '{}':{}ms", query, (stop - start));
return ret;
}
use of java.io.OutputStreamWriter in project Signal-Android by WhisperSystems.
the class SmilXmlSerializer method serialize.
public static void serialize(SMILDocument smilDoc, OutputStream out) {
try {
Writer writer = new BufferedWriter(new OutputStreamWriter(out, "UTF-8"), 2048);
writeElement(writer, smilDoc.getDocumentElement());
writer.flush();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
Aggregations