From: David ‘Bombe’ Roden Date: Sun, 14 Apr 2013 12:35:55 +0000 (+0200) Subject: Remove write() methods to prevent mulitple flush()s per line. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=6df6da151ec3804a8f3cc8ac65277842358d7e38;p=xudocci.git Remove write() methods to prevent mulitple flush()s per line. --- diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java index 795fe98..a530a1d 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java @@ -119,17 +119,17 @@ public class CommandReader extends AbstractExecutionThreadService { } else if (words[0].equalsIgnoreCase("dcc")) { int counter = 0; for (DccReceiver dccReceiver : core.dccReceivers()) { - write(String.format("[%d] %s (%s, ", counter++, dccReceiver.filename(), dccReceiver.size())); + writer.write(String.format("[%d] %s (%s, ", counter++, dccReceiver.filename(), f(dccReceiver.size()))); if (dccReceiver.isRunning()) { - write(String.format("%.1f%%, %s", dccReceiver.progress() * 100.0 / dccReceiver.size(), f(dccReceiver.currentRate()))); + writer.write(String.format("%.1f%%, %s", dccReceiver.progress() * 100.0 / dccReceiver.size(), f(dccReceiver.currentRate()))); } else { if (dccReceiver.progress() >= dccReceiver.size()) { - write(String.format("complete, %s", f(dccReceiver.overallRate()))); + writer.write(String.format("complete, %s", f(dccReceiver.overallRate()))); } else { - write(String.format("aborted at %.1f%%, %s", dccReceiver.progress() * 100.0 / dccReceiver.size(), f(dccReceiver.currentRate()))); + writer.write(String.format("aborted at %.1f%%, %s", dccReceiver.progress() * 100.0 / dccReceiver.size(), f(dccReceiver.currentRate()))); } } - write("/s)\n"); + writer.write("/s)\n"); } writeLine("End of DCCs."); } else if (words[0].equalsIgnoreCase("get")) { @@ -245,19 +245,6 @@ public class CommandReader extends AbstractExecutionThreadService { // /** - * Writes the given text to the {@link #writer}. - * - * @param text - * The text to write - * @throws IOException - * if an I/O error occurs - */ - private void write(String text) throws IOException { - writer.write(text); - writer.flush(); - } - - /** * Writes the given line followed by an LF to the {@link #writer}. * * @param line