Can't understand this block of code and need explanation?


#1
   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!


#2

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.