Actually readreturns an integer.
public abstract int read() throws IOException
therefore it is pushed to be an unsigned byte, storing it in int.
:
. int 0 255. , , -1.
, , -1 .
OutputStream
public abstract void write(int b) throws IOException
, , 8 .