hasPending

Whether a read would find something without waiting: bytes left in the buffer, or bytes the underlying stream already holds.

The underlying stream's own count is what available() makes of it - on a plain socket what the kernel has received, on a TLS one only what has already been decrypted.