Created
May 19, 2014 12:52
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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