The second, potentially long way. Reading a block at a time is almost always preferable to reading a byte at a time, unless you really want to read one byte anyway.
, read, , - . , 2048 . - :
int bytesRead;
while ((bytesRead = inputStream.read(buffer, 0, buffer.length)) > 0)
{
}
2K ... , , , .