Isn't it better to use the BufferedReader function readLine() instead of read() or read(byte[])?
The reason I ask is because of potential memory wastage by the read() function.
If I specify a byte array of size 10, then it will become capable of accepting ten bytes from the transmitter. However, if the transmitter transmits only four bytes, the remaining six bytes would be wasted.
Keeping this in mind, it would be practically smarter to use the readLine() function to avoid any memory wastage.
I am an absolute beginner in Java, so please pardon me if I sound incompetent.