Im making a simple TCP/IP Socket app
Whats the different between doing this:
DataInputStream in = new DataInputStream(clientSocket.getInputStream());
byte[] buffer = new byte[100];
in.readFully(buffer);
versus doing this:
DataInputStream in = new DataInputStream(clientSocket.getInputStream());
byte[] buffer = new byte[100];
in.read(buffer);
I had a look at the documentation, they have the same exact description. readFully()
and read()
So can I assume its the same thing?
readFully()
returns when the buffer is full regardless of if there there are more bytes remaining to be read. Andread()
returns when all the bytes have been read. Correct? – Drunkread()
returns when at least one byte has been read;readFully()
when the buffer has been filled. – Elyssa