package com.cloudera.flume.handlers.debug;
import java.io.IOException;
import com.cloudera.flume.conf.SourceFactory.SourceBuilder;
import com.cloudera.flume.core.Event;
import com.cloudera.flume.core.EventSource;
super(count, size, seed);
}
super(count, size);
}
public Event
next()
throws IOException {
Event e = super.next();
if (e == null)
return null;
byte[] body = e.getBody();
for (int i = 0; i < body.length; i++) {
if (body[i] == '\n')
body[i] = ' ';
}
return e;
}
public static SourceBuilder
builder() {
return new SourceBuilder() {
@Override
public EventSource
build(String... argv) {
int size = 150;
long count = 0;
if (argv.length > 2) {
throw new IllegalArgumentException(
"usage: asciisynth([count=0 [,randsize=150]]) // count=0 infinite");
}
if (argv.length >= 1) {
count = Long.parseLong(argv[0]);
}
if (argv.length >= 2)
size = Integer.parseInt(argv[1]);
return new NoNlSynthSource(count, size);
}
};
}
}