Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
From http://stackoverflow.com/questions/3886201/java-outputting-text-file-to-console Print the content of a text file to the console. I used it to print a logo.
try {
// draw logo to console
InputStream input = new BufferedInputStream(new FileInputStream("src/main/resources/logo.txt"));
byte[] buffer = new byte[8192];
try {
for (int length = 0; (length = input.read(buffer)) != -1;) {
System.out.write(buffer, 0, length);
}
} finally {
input.close();
}
} catch (IOException e) {
logger.warn("Failed to draw logo file: " + e.getMessage());
}
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.