Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private static void printRawResults(InputStream stream) {
OutputStreamWriter writer = new OutputStreamWriter(System.out);
// stream results and write to STD OUT
try {
InputStreamReader reader = new InputStreamReader(stream);
int size = 1024;
char[] buffer = new char[size];
while (true) {
int count = reader.read(buffer);
if (count == -1)
break;
writer.write(buffer, 0, count);
}
writer.flush();
reader.close();
} catch (Exception e) {
} finally {
try {
writer.close();
} catch (IOException e) {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.