Reformat to use Fabric API's checkstyle (#137)

* Reformat to use Fabric API's checkstyle

* Fix

* Fix

* Update

* Travis and fixes

* possible fix for checkstyle?

* Helps if i push the checkstyle.xml file...

* Log checkstyle issues to console - used by travis

* Fix some more issues

* opps
This commit is contained in:
modmuss50
2019-11-02 20:23:27 +00:00
committed by GitHub
parent 2bd339241f
commit f85daec559
59 changed files with 2129 additions and 1655 deletions

View File

@@ -32,33 +32,36 @@ import java.util.function.Consumer;
* Created by covers1624 on 20/12/18.
*/
public class ConsumingOutputStream extends OutputStream {
private final Consumer<String> consumer;
private final Consumer<String> consumer;
private StringBuilder buffer = new StringBuilder();
private StringBuilder buffer = new StringBuilder();
public ConsumingOutputStream(Consumer<String> consumer) {
this.consumer = consumer;
}
public ConsumingOutputStream(Consumer<String> consumer) {
this.consumer = consumer;
}
@Override
public void write(int b) throws IOException {
char ch = (char) (b & 0xFF);
buffer.append(ch);
@Override
public void write(int b) throws IOException {
char ch = (char) (b & 0xFF);
buffer.append(ch);
if (ch == '\n' || ch == '\r') {
flush();
}
}
if (ch == '\n' || ch == '\r') {
flush();
}
}
@Override
public void flush() throws IOException {
String str = buffer.toString();
if (str.endsWith("\r") || str.endsWith("\n")) {
str = str.trim();
if (!str.isEmpty()) {
consumer.accept(str);
}
buffer = new StringBuilder();
}
}
@Override
public void flush() throws IOException {
String str = buffer.toString();
if (str.endsWith("\r") || str.endsWith("\n")) {
str = str.trim();
if (!str.isEmpty()) {
consumer.accept(str);
}
buffer = new StringBuilder();
}
}
}