If I use int oneByte = dis.read(byteArray, 0, 1) does this mean I am reading only 1 byte and I am assigning its decimal value to integer oneByte?
If I want to check for | (pipe) character to break out of a loop can I do something like this:
while((oneByte = dis.read(byteArray, 0, 1)) != 124)
Nope. You’re reading up to 1 bytes into
byteArrayand receiving the number of bytes read inoneByte. Perhaps you’d prefer:Also be careful because you’ll get the integer value…not a decimal. Keep in mind that it will return
-1when you reach the end of the stream.You’ll need to also check for the end of stream (-1). Try something more like this: