本文整理汇总了Java中me.tongfei.progressbar.ProgressBar类的典型用法代码示例。如果您正苦于以下问题:Java ProgressBar类的具体用法?Java ProgressBar怎么用?Java ProgressBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProgressBar类属于me.tongfei.progressbar包,在下文中一共展示了ProgressBar类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mark
import me.tongfei.progressbar.ProgressBar; //导入依赖的package包/类
/**
* Marks all of the submissions.
* @param threads The thread-pool size to use in marking the assignments
*/
public void mark(final int threads)
throws Exception {
final ProgressBar pb = new ProgressBar("Marking", this.submissions.size());
pb.start();
final CountDownLatch latch = new CountDownLatch(this.submissions.size());
final ThreadPoolExecutor executor = new ThreadPoolExecutor(
threads,
threads,
0L,
TimeUnit.MILLISECONDS,
new ArrayBlockingQueue<>(threads),
new ThreadPoolExecutor.CallerRunsPolicy()
);
for (Submission s : this.submissions) {
executor.submit(() -> {
try {
s.results(this.markingResults(s.directory()));
pb.step();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
latch.countDown();
}
});
}
executor.shutdown();
latch.await();
pb.stop();
}
示例2: ProgressStream
import me.tongfei.progressbar.ProgressBar; //导入依赖的package包/类
/**
* ProgressStream implements an extends InputStream while also writing out the read progress on
* console. ProgressStream can be used as a direct replacement for any InputStream compatible
* input.
*
* @param msg Custom message string.
* @param style Custom progress bar style.
* @param size Size of the progress bar.
* @param stream InputStream to be wrapped.
* @throws IOException For any exception generated by the InputStream.
*/
public ProgressStream(String msg, ProgressBarStyle style, long size, InputStream stream)
throws IOException {
super();
// Allocate the reader.
this.in = stream;
// Initialize progress bar.
this.pb = new ProgressBar(msg, size, style);
this.pb.start();
}
示例3: printBar
import me.tongfei.progressbar.ProgressBar; //导入依赖的package包/类
public void printBar(ProgressGauge progressGauge) {
PrintStream os = new PrintStream(new WriterOutputStream(rawPrint ? pw : console.getOutput()));
String label = app().config().i18nEnabled() ? i18n("act.progress.capFirst") : "Progress";
ProgressBar pb = new ProgressBar(label, progressGauge.maxHint(), 200, os, ProgressBarStyle.UNICODE_BLOCK);
pb.start();
while (!progressGauge.done()) {
pb.maxHint(progressGauge.maxHint());
pb.stepTo(progressGauge.currentSteps());
flush();
}
pb.stepTo(pb.getMax());
pb.stop();
}
示例4: message
import me.tongfei.progressbar.ProgressBar; //导入依赖的package包/类
@Override
public void message(ProgressBar pb) {
pb.setExtraMessage("Getting BibText informations...");
}
示例5: message
import me.tongfei.progressbar.ProgressBar; //导入依赖的package包/类
@Override
public void message(ProgressBar pb) {
pb.setExtraMessage("Getting RIS informations...");
}
示例6: message
import me.tongfei.progressbar.ProgressBar; //导入依赖的package包/类
/**
* Put message to Progress Bar
* @param pb
*/
default void message(ProgressBar pb) {
pb.setExtraMessage("Getting Information");
}