use of com.ibm.streamsx.topology.function.Consumer in project streamsx.topology by IBMStreams.
the class FileStreamsTest method createFiles.
@SuppressWarnings("serial")
static Consumer<Long> createFiles(final String[] files, final int repeat) {
return new Consumer<Long>() {
@Override
public void accept(Long arg0) {
try {
for (int r = 0; r < repeat; r++) {
for (int i = 0; i < files.length; i++) {
Path path = Paths.get(files[i]);
if (repeat > 1) {
path.toFile().delete();
Thread.sleep(10);
}
Files.createFile(path);
Thread.sleep(10);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
}