Following on from yesterday’s post about reactive programming using Spring Reactive Web, I thought it would be interest to expand upon the example. In this post we’ll take a look at one of the cooler aspects of the new reactive model, result streaming.
Without going into too much backstory around reactive programming, the short explanation is that it is a technique for writing asynchronous, event driven, non-blocking applications.
I’m hoping to write a few posts about some of the techniques I’ve been playing around with. I’ve been really interested in keeping my services as functional as possible.
Inspired by a forum post on osdev.org about image colour down-sampling I decided to have a crack at writing a program which could take a 24-bit image and convert it down to any lesser image format. The picture above shows an image split down the middle. On the right is the original 24-bit colour version and on the left is a 8-bit per pixel version with 2 bits for the red colour channel and 3 bits for the green and blue colour channels (rather than having a specific palette for the image I am down-sampling to a 2:3:3 BPP image). As you can see the colour loss is acceptable and despite the limitations it still looks nice. Obviously the image could be improved further by choosing a colour palette suitable for the image but that is for another project.
UnHexDump takes the familiar output of HexDump and converts it back into nice binary format. I wrote this program to assist in extracting files off my Cisco 7970 IP phone which lacks any remote file copying capability.