xybrek :
I have this code that captures images from a webcam, 1 image per second.
Flowable.interval(0, 1, TimeUnit.MILLISECONDS)
.map(aLong -> {
BufferedImage bufferedImage = webcam.getImage();
return bufferedImage;
}).subscribe(bufferedImage -> {
if(bufferedImage != null) {
}
// Capture 1000 images
}, error -> {
System.out.println(error.getMessage());
});
With RxJava how can I make it buffer 300 images first then that 300 images (probably a Java array) would be passed into a method for processing, say processImages(bufferedImageArray);
bubbles :
just use buffer(count)
operator :
Flowable.interval(0, 1, TimeUnit.MILLISECONDS)
.map(...)
.buffer(300)
.subscribe(...)