Skip to content

Instantly share code, notes, and snippets.

@davidraviv
Created May 19, 2014 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidraviv/af9b2bd95cf54b011849 to your computer and use it in GitHub Desktop.
Save davidraviv/af9b2bd95cf54b011849 to your computer and use it in GitHub Desktop.
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