com.tw.go.plugin.cmd.InMemoryConsumer Maven / Gradle / Ivy
package com.tw.go.plugin.cmd;
import com.tw.go.plugin.util.ListUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
public class InMemoryConsumer implements StreamConsumer {
private Queue lines = new ConcurrentLinkedQueue();
public void consumeLine(String line) {
try {
lines.add(line);
} catch (RuntimeException e) {
// LOG.error("Problem consuming line [" + line + "]", e);
}
}
public List asList() {
return new ArrayList(lines);
}
public String toString() {
return ListUtil.join(asList(), "\n");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy