My goal is to read the n number of bytes
from a Socket
.
Is it better to directly read from the InputStream
, or wrap it into a BufferedReader
?
Throughout the net you find both approaches, but none states which to use when.
Socket socket;
is = socket.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
char[] buffer = new char[CONTENT_LENGTH];
//what is better?
is.read(buffer);
br.read(buffer);