Can't understand this block of code and need explanation?
from the CommonsWare Community archivesAt September 5, 2018, 12:30pm, hackzcorporation asked:
InputStream in=c.getInputStream();
byte[] buffer=new byte[8192];
int len=0;
while ((len=in.read(buffer)) >= 0) {
out.write(buffer, 0, len);
}
From Services and the Command Pattern, Scenario:The Downloader
I don’t know if this is the correct way or not for asking for the code explanation where I’m stuck!
At September 5, 2018, 1:06pm, mmurphy replied:
That is simple Java I/O, the sort of thing that you would learn from a Java book. It reads bytes from an InputStream
and writes them to an OutputStream
.
Beyond that, I do not really know how to answer your question.