Char-devices versus block devices versus plain files

I have an app supposed to read data from either an UART (e.g. /dev/ttyUSB0) or a plain file.

I have different classes handling the two sources but can't find a nice method but searching for "/dev" in the name to distinguish between the two and thereby choosing which of my classes to use.

I've found means in juce to distinguish between plain files and directories but would like means to test for block devices, char devices, pipes, links, sockets etc like in e.g. bash where you write if [ -b xxxx] to test for a block device (or -c, -p, -f, -S, -L etc

Any ideas?