Skip to content

Commit a00711c

Browse files
committed
Avoid possible flushing problems when displaying the logo
Sometimes a dangling 'h' appears on the console...
1 parent 9f43faa commit a00711c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/main/java/org/fusesource/jansi/AnsiMain.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

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

20+
import java.io.BufferedReader;
2021
import java.io.Closeable;
2122
import java.io.File;
2223
import java.io.FileInputStream;
@@ -199,14 +200,11 @@ private static String getPomPropertiesVersion(String path) throws IOException {
199200
}
200201

201202
private static void printJansiLogoDemo() throws IOException {
202-
Reader in = new InputStreamReader(AnsiMain.class.getResourceAsStream("jansi.txt"), "UTF-8");
203+
BufferedReader in = new BufferedReader(new InputStreamReader(AnsiMain.class.getResourceAsStream("jansi.txt"), "UTF-8"));
203204
try {
204-
char[] buf = new char[1024];
205-
int l = 0;
206-
while ((l = in.read(buf)) >= 0) {
207-
for(int i = 0; i < l; i++) {
208-
System.out.print(buf[i]);
209-
}
205+
String l;
206+
while ((l = in.readLine()) != null) {
207+
System.out.println(l);
210208
}
211209
} finally {
212210
closeQuietly(in);

0 commit comments

Comments
 (0)