Skip to content

Commit

Permalink
Avoid possible flushing problems when displaying the logo
Browse files Browse the repository at this point in the history
Sometimes a dangling 'h' appears on the console...
  • Loading branch information
gnodet committed Dec 2, 2020
1 parent 9f43faa commit a00711c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/main/java/org/fusesource/jansi/AnsiMain.java
Expand Up @@ -17,6 +17,7 @@

import static org.fusesource.jansi.Ansi.ansi;

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
Expand Down Expand Up @@ -199,14 +200,11 @@ private static String getPomPropertiesVersion(String path) throws IOException {
}

private static void printJansiLogoDemo() throws IOException {
Reader in = new InputStreamReader(AnsiMain.class.getResourceAsStream("jansi.txt"), "UTF-8");
BufferedReader in = new BufferedReader(new InputStreamReader(AnsiMain.class.getResourceAsStream("jansi.txt"), "UTF-8"));
try {
char[] buf = new char[1024];
int l = 0;
while ((l = in.read(buf)) >= 0) {
for(int i = 0; i < l; i++) {
System.out.print(buf[i]);
}
String l;
while ((l = in.readLine()) != null) {
System.out.println(l);
}
} finally {
closeQuietly(in);
Expand Down

0 comments on commit a00711c

Please sign in to comment.