mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 13:37:45 -05:00
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:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user